···1112 mkPathSafeName = lib.replaceChars ["@" ":" "\\" "[" "]"] ["-" "-" "-" "" ""];
1314+ # a type for options that take a unit name
15+ unitNameType = types.strMatching "[a-zA-Z0-9@%:_.\\-]+[.](service|socket|device|mount|automount|swap|target|path|timer|scope|slice)";
16+17 makeUnit = name: unit:
18 if unit.enable then
19 pkgs.runCommand "unit-${mkPathSafeName name}"
+12-12
nixos/lib/systemd-unit-options.nix
···4546 requiredBy = mkOption {
47 default = [];
48- type = types.listOf types.str;
49 description = ''
50 Units that require (i.e. depend on and need to go down with)
51 this unit. The discussion under <literal>wantedBy</literal>
···5657 wantedBy = mkOption {
58 default = [];
59- type = types.listOf types.str;
60 description = ''
61 Units that want (i.e. depend on) this unit. The standard way
62 to make a unit start by default at boot is to set this option
···7374 aliases = mkOption {
75 default = [];
76- type = types.listOf types.str;
77 description = "Aliases of that unit.";
78 };
79···110111 requires = mkOption {
112 default = [];
113- type = types.listOf types.str;
114 description = ''
115 Start the specified units when this unit is started, and stop
116 this unit when the specified units are stopped or fail.
···119120 wants = mkOption {
121 default = [];
122- type = types.listOf types.str;
123 description = ''
124 Start the specified units when this unit is started.
125 '';
···127128 after = mkOption {
129 default = [];
130- type = types.listOf types.str;
131 description = ''
132 If the specified units are started at the same time as
133 this unit, delay this unit until they have started.
···136137 before = mkOption {
138 default = [];
139- type = types.listOf types.str;
140 description = ''
141 If the specified units are started at the same time as
142 this unit, delay them until this unit has started.
···145146 bindsTo = mkOption {
147 default = [];
148- type = types.listOf types.str;
149 description = ''
150 Like ‘requires’, but in addition, if the specified units
151 unexpectedly disappear, this unit will be stopped as well.
···154155 partOf = mkOption {
156 default = [];
157- type = types.listOf types.str;
158 description = ''
159 If the specified units are stopped or restarted, then this
160 unit is stopped or restarted as well.
···163164 conflicts = mkOption {
165 default = [];
166- type = types.listOf types.str;
167 description = ''
168 If the specified units are started, then this unit is stopped
169 and vice versa.
···172173 requisite = mkOption {
174 default = [];
175- type = types.listOf types.str;
176 description = ''
177 Similar to requires. However if the units listed are not started,
178 they will not be started and the transaction will fail.
···203204 onFailure = mkOption {
205 default = [];
206- type = types.listOf types.str;
207 description = ''
208 A list of one or more units that are activated when
209 this unit enters the "failed" state.
···4546 requiredBy = mkOption {
47 default = [];
48+ type = types.listOf unitNameType;
49 description = ''
50 Units that require (i.e. depend on and need to go down with)
51 this unit. The discussion under <literal>wantedBy</literal>
···5657 wantedBy = mkOption {
58 default = [];
59+ type = types.listOf unitNameType;
60 description = ''
61 Units that want (i.e. depend on) this unit. The standard way
62 to make a unit start by default at boot is to set this option
···7374 aliases = mkOption {
75 default = [];
76+ type = types.listOf unitNameType;
77 description = "Aliases of that unit.";
78 };
79···110111 requires = mkOption {
112 default = [];
113+ type = types.listOf unitNameType;
114 description = ''
115 Start the specified units when this unit is started, and stop
116 this unit when the specified units are stopped or fail.
···119120 wants = mkOption {
121 default = [];
122+ type = types.listOf unitNameType;
123 description = ''
124 Start the specified units when this unit is started.
125 '';
···127128 after = mkOption {
129 default = [];
130+ type = types.listOf unitNameType;
131 description = ''
132 If the specified units are started at the same time as
133 this unit, delay this unit until they have started.
···136137 before = mkOption {
138 default = [];
139+ type = types.listOf unitNameType;
140 description = ''
141 If the specified units are started at the same time as
142 this unit, delay them until this unit has started.
···145146 bindsTo = mkOption {
147 default = [];
148+ type = types.listOf unitNameType;
149 description = ''
150 Like ‘requires’, but in addition, if the specified units
151 unexpectedly disappear, this unit will be stopped as well.
···154155 partOf = mkOption {
156 default = [];
157+ type = types.listOf unitNameType;
158 description = ''
159 If the specified units are stopped or restarted, then this
160 unit is stopped or restarted as well.
···163164 conflicts = mkOption {
165 default = [];
166+ type = types.listOf unitNameType;
167 description = ''
168 If the specified units are started, then this unit is stopped
169 and vice versa.
···172173 requisite = mkOption {
174 default = [];
175+ type = types.listOf unitNameType;
176 description = ''
177 Similar to requires. However if the units listed are not started,
178 they will not be started and the transaction will fail.
···203204 onFailure = mkOption {
205 default = [];
206+ type = types.listOf unitNameType;
207 description = ''
208 A list of one or more units that are activated when
209 this unit enters the "failed" state.