Write generation state into a state file and restructure the services.json file produced by nix.

This commit is contained in:
R-VdP 2023-02-09 10:25:04 +00:00
parent 8f31818a27
commit c3be9ceb19
No known key found for this signature in database
6 changed files with 143 additions and 80 deletions

View file

@ -4,31 +4,32 @@
}:
let
services =
lib.listToAttrs (lib.flip lib.genList 30 (ix: {
name = "service-${toString ix}";
value = {
enable = true;
description = "service-${toString ix}";
wants = [ "network-online.target" ];
after = [
"network-online.target"
"avahi-daemon.service"
"chrony.service"
"nss-lookup.target"
"tinc.service"
"pulseaudio.service"
];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecReload = "true";
};
wantedBy = [ "multi-user.target" ];
script = ''
sleep ${if ix > 20 then "3" else "1"}
'';
};
}));
lib.listToAttrs
(lib.flip lib.genList 10 (ix:
lib.nameValuePair "service-${toString ix}"
{
enable = true;
description = "service-${toString ix}";
wants = [ "network-online.target" ];
after = [
"network-online.target"
"avahi-daemon.service"
"chrony.service"
"nss-lookup.target"
"tinc.service"
"pulseaudio.service"
];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
ExecReload = "true";
};
wantedBy = [ "multi-user.target" ];
script = ''
sleep ${if ix > 5 then "3" else "1"}
'';
})
);
in
{
options = {