fix llm stuff

This commit is contained in:
atagen 2024-09-11 10:15:54 +10:00
parent ad421cea84
commit 5786863608
12 changed files with 131 additions and 95 deletions

View file

@ -303,7 +303,7 @@
++ map escapeShellArg container.cmd
);
inherit (lib) concatStringsSep escapeShellArg optional optionalAttrs optionalString mapAttrsToList;
inherit (lib) concatStringsSep escapeShellArg optional mapAttrsToList;
in {
Unit = {
WantedBy = [] ++ lib.optional (container.autoStart) "default.target"; # graphical-session instead maybe?

View file

@ -4,9 +4,22 @@
lib,
...
}: let
inherit (lib) mkOption;
inherit (lib.attrsets) mapAttrs mapAttrs' nameValuePair;
inherit (lib) getExe getExe';
inherit
(lib)
mkOption
mkForce
getExe
getExe'
listToAttrs
flatten
mapAttrsToList
mapAttrs
mapAttrs'
nameValuePair
toLower
replaceStrings
concatMapStringsSep
;
# make a firefox webapp + hidden .desktop entry for the client app
make-firefox = cfg:
mapAttrs' (
@ -31,7 +44,7 @@
nameValuePair "${cfg.name}-frontend" {
Unit = {
Description = "${cfg.name} Frontend";
WantedBy = lib.mkForce [];
WantedBy = mkForce [];
};
Service = cfg.service;
@ -41,13 +54,13 @@
cfg;
# modify systemd units to be PartOf this target
modify-systemd-services = cfg:
lib.listToAttrs (lib.flatten (lib.mapAttrsToList (
listToAttrs (flatten (mapAttrsToList (
name: cfg: (map (
req: {
name = "${req}";
value = {
Unit = {
PartOf = "${lib.toLower cfg.name}.target";
PartOf = "${replaceStrings [" "] ["-"] (toLower cfg.name)}.target";
};
};
}
@ -56,13 +69,13 @@
)
cfg));
modify-quadlets = cfg:
lib.listToAttrs (lib.flatten (lib.mapAttrsToList (
listToAttrs (flatten (mapAttrsToList (
name: cfg: (map (
req: {
name = "${req}";
value = {
unitConfig = {
PartOf = "${lib.toLower cfg.name}.target";
PartOf = "${toLower cfg.name}.target";
};
};
}
@ -76,7 +89,7 @@
name: cfg: {
Unit = {
Description = "${cfg.name} Target";
WantedBy = lib.mkForce [];
WantedBy = mkForce [];
Requires =
(map (req: req + ".service") cfg.requires.services)
++ (map (req: "podman-" + req + ".service") cfg.requires.containers);
@ -105,7 +118,7 @@
''
container_checks() {
if ''
+ (lib.concatMapStringsSep " && "
+ (concatMapStringsSep " && "
(container: makeContainerCheck container)
cfg.requires.containers)
+ ''

17
home/util/name.nix Normal file
View file

@ -0,0 +1,17 @@
{
lib,
config,
...
}: let
inherit (lib) mkOption;
in {
options.mainUser = mkOption {
type = lib.types.str;
};
config.home = let
inherit (config) mainUser;
in {
username = mainUser;
homeDirectory = "/home/${mainUser}";
};
}