Create more services to test activation logic.
This commit is contained in:
parent
50b4212a06
commit
c7a481976d
2 changed files with 34 additions and 44 deletions
13
nix/lib.nix
13
nix/lib.nix
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue