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 = { };
|
||||
};
|
||||
|
||||
services = map
|
||||
(name: {
|
||||
inherit name;
|
||||
service = ''${nixosConfig.config.systemd.units."${name}.service".unit}/${name}.service'';
|
||||
services =
|
||||
map
|
||||
(name:
|
||||
let
|
||||
serviceName = "${name}.service";
|
||||
in
|
||||
{
|
||||
name = serviceName;
|
||||
service = ''${nixosConfig.config.systemd.units."${serviceName}".unit}/${serviceName}'';
|
||||
})
|
||||
nixosConfig.config.service-manager.services;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,13 +3,12 @@
|
|||
, ...
|
||||
}:
|
||||
let
|
||||
service-1 = "service-1";
|
||||
service-2 = "service-2";
|
||||
|
||||
services = {
|
||||
${service-1} = {
|
||||
services =
|
||||
lib.listToAttrs (lib.flip lib.genList 30 (ix: {
|
||||
name = "service-${toString ix}";
|
||||
value = {
|
||||
enable = true;
|
||||
description = service-1;
|
||||
description = "service-${toString ix}";
|
||||
wants = [ "network-online.target" ];
|
||||
after = [
|
||||
"network-online.target"
|
||||
|
|
@ -22,28 +21,14 @@ let
|
|||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
RemainAfterExit = true;
|
||||
script = ''
|
||||
true
|
||||
'';
|
||||
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
|
||||
sleep ${if ix > 20 then "3" else "1"}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}));
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue