Create more services to test activation logic.

This commit is contained in:
R-VdP 2023-02-07 23:19:25 +00:00
parent 50b4212a06
commit c7a481976d
No known key found for this signature in database
2 changed files with 34 additions and 44 deletions

View file

@ -17,12 +17,17 @@ in
specialArgs = { }; specialArgs = { };
}; };
services = map services =
(name: { map
inherit name; (name:
service = ''${nixosConfig.config.systemd.units."${name}.service".unit}/${name}.service''; let
}) serviceName = "${name}.service";
nixosConfig.config.service-manager.services; in
{
name = serviceName;
service = ''${nixosConfig.config.systemd.units."${serviceName}".unit}/${serviceName}'';
})
nixosConfig.config.service-manager.services;
servicesPath = pkgs.writeTextFile { servicesPath = pkgs.writeTextFile {
name = "services"; name = "services";

View file

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