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,10 +17,15 @@ 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";
in
{
name = serviceName;
service = ''${nixosConfig.config.systemd.units."${serviceName}".unit}/${serviceName}'';
}) })
nixosConfig.config.service-manager.services; nixosConfig.config.service-manager.services;

View file

@ -3,13 +3,12 @@
, ... , ...
}: }:
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-1; description = "service-${toString ix}";
wants = [ "network-online.target" ]; wants = [ "network-online.target" ];
after = [ after = [
"network-online.target" "network-online.target"
@ -22,28 +21,14 @@ let
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
RemainAfterExit = true; RemainAfterExit = true;
script = ''
true
'';
ExecReload = "true"; ExecReload = "true";
}; };
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
};
${service-2} = {
enable = true;
description = service-2;
serviceConfig = {
Type = "simple";
};
partOf = [ "${service-1}.service" ];
wantedBy = [ "${service-1}.service" ];
script = '' script = ''
true sleep ${if ix > 20 then "3" else "1"}
''; '';
}; };
}; }));
in in
{ {
options = { options = {