more pipe rewriting
This commit is contained in:
parent
fbd6b16962
commit
b863568077
@ -37,44 +37,47 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (lib.any (s: s.enable) (lib.attrValues config.my.scripts)) {
|
config = lib.mkIf (lib.any (s: s.enable) (lib.attrValues config.my.scripts)) {
|
||||||
users.users.jawz.packages = lib.flatten (
|
users.users.jawz.packages =
|
||||||
lib.mapAttrsToList (
|
config.my.scripts
|
||||||
_name: script: lib.optional (script.enable && script.install) script.package
|
|> lib.mapAttrsToList (_name: script: lib.optional (script.enable && script.install) script.package)
|
||||||
) config.my.scripts
|
|> lib.flatten;
|
||||||
);
|
|
||||||
|
|
||||||
systemd.user.services = lib.mapAttrs' (
|
systemd.user.services =
|
||||||
name: script:
|
config.my.scripts
|
||||||
lib.nameValuePair "${script.name}" (
|
|> lib.mapAttrs' (
|
||||||
lib.mkIf (script.enable && script.service) {
|
name: script:
|
||||||
restartIfChanged = true;
|
lib.nameValuePair "${script.name}" (
|
||||||
inherit (script) description;
|
lib.mkIf (script.enable && script.service) {
|
||||||
wantedBy = [ "default.target" ];
|
restartIfChanged = true;
|
||||||
path = [
|
inherit (script) description;
|
||||||
pkgs.nix
|
wantedBy = [ "default.target" ];
|
||||||
script.package
|
path = [
|
||||||
];
|
pkgs.nix
|
||||||
serviceConfig = {
|
script.package
|
||||||
Restart = "on-failure";
|
];
|
||||||
RestartSec = 30;
|
serviceConfig = {
|
||||||
ExecStart = "${script.package}/bin/${script.name}";
|
Restart = "on-failure";
|
||||||
};
|
RestartSec = 30;
|
||||||
}
|
ExecStart = "${script.package}/bin/${script.name}";
|
||||||
)
|
};
|
||||||
) config.my.scripts;
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
systemd.user.timers = lib.mapAttrs' (
|
systemd.user.timers =
|
||||||
name: script:
|
config.my.scripts
|
||||||
lib.nameValuePair "${script.name}" (
|
|> lib.mapAttrs' (
|
||||||
lib.mkIf (script.enable && script.service) {
|
name: script:
|
||||||
enable = true;
|
lib.nameValuePair "${script.name}" (
|
||||||
inherit (script) description;
|
lib.mkIf (script.enable && script.service) {
|
||||||
wantedBy = [ "timers.target" ];
|
enable = true;
|
||||||
timerConfig = {
|
inherit (script) description;
|
||||||
OnCalendar = script.timer;
|
wantedBy = [ "timers.target" ];
|
||||||
};
|
timerConfig = {
|
||||||
}
|
OnCalendar = script.timer;
|
||||||
)
|
};
|
||||||
) config.my.scripts;
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user