Add support for PartOf dependencies
This commit is contained in:
parent
c2b2a3369a
commit
981347429a
@ -47,6 +47,15 @@ with pkgs.lib;
|
||||
'';
|
||||
};
|
||||
|
||||
partOf = mkOption {
|
||||
default = [];
|
||||
types = types.listOf types.string;
|
||||
description = ''
|
||||
If the specified units are stopped or restarted, then this
|
||||
unit is stopped or restarted as well.
|
||||
'';
|
||||
};
|
||||
|
||||
wantedBy = mkOption {
|
||||
default = [];
|
||||
types = types.listOf types.string;
|
||||
|
@ -191,8 +191,9 @@ let
|
||||
''}
|
||||
Requires=${concatStringsSep " " def.requires}
|
||||
Wants=${concatStringsSep " " def.wants}
|
||||
Before=${concatStringsSep " " def.before}
|
||||
After=${concatStringsSep " " def.after}
|
||||
Before=${concatStringsSep " " def.before}
|
||||
PartOf=${concatStringsSep " " def.partOf}
|
||||
${def.unitConfig}
|
||||
|
||||
[Service]
|
||||
|
@ -54,17 +54,20 @@ let
|
||||
'';
|
||||
in {
|
||||
|
||||
inherit (job) description requires wants before environment path;
|
||||
inherit (job) description requires wants before partOf environment path;
|
||||
|
||||
after =
|
||||
(if job.startOn == "stopped udevtrigger" then [ "systemd-udev-settle.service" ] else
|
||||
if job.startOn == "started udev" then [ "systemd-udev.service" ] else
|
||||
if job.startOn == "" || job.startOn == "startup" then [ ] else
|
||||
if job.startOn == "ip-up" then [] else
|
||||
if job.startOn == "" || job.startOn == "startup" then [] else
|
||||
builtins.trace "Warning: job ‘${job.name}’ has unknown startOn value ‘${job.startOn}’." []
|
||||
) ++ job.after;
|
||||
|
||||
wantedBy =
|
||||
(if job.startOn == "" then [ ] else [ "multi-user.target" ]) ++ job.wantedBy;
|
||||
(if job.startOn == "" then [] else
|
||||
if job.startOn == "ip-up" then [ "ip-up.target" ] else
|
||||
[ "multi-user.target" ]) ++ job.wantedBy;
|
||||
|
||||
serviceConfig =
|
||||
''
|
||||
|
Loading…
Reference in New Issue
Block a user