Loading nixos/lib/systemd-lib.nix +9 −1 Original line number Diff line number Diff line Loading @@ -242,7 +242,7 @@ in rec { ln -sfn '${name}' $out/'${name2}' '') (unit.aliases or [])) units)} # Create .wants and .requires symlinks from the wantedBy and # Create .wants, .upholds and .requires symlinks from the wantedBy, upheldBy and # requiredBy options. ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' Loading @@ -250,6 +250,12 @@ in rec { ln -sfn '../${name}' $out/'${name2}.wants'/ '') (unit.wantedBy or [])) units)} ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' mkdir -p $out/'${name2}.upholds' ln -sfn '../${name}' $out/'${name2}.upholds'/ '') (unit.upheldBy or [])) units)} ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' mkdir -p $out/'${name2}.requires' Loading Loading @@ -289,6 +295,8 @@ in rec { { Requires = toString config.requires; } // optionalAttrs (config.wants != []) { Wants = toString config.wants; } // optionalAttrs (config.upholds != []) { Upholds = toString config.upholds; } // optionalAttrs (config.after != []) { After = toString config.after; } // optionalAttrs (config.before != []) Loading nixos/lib/systemd-unit-options.nix +23 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,15 @@ in rec { ''; }; upheldBy = mkOption { default = []; type = types.listOf unitNameType; description = lib.mdDoc '' Keep this unit running as long as the listed units are running. This is a continuously enforced version of wantedBy. ''; }; wantedBy = mkOption { default = []; type = types.listOf unitNameType; Loading Loading @@ -147,6 +156,20 @@ in rec { ''; }; upholds = mkOption { default = []; type = types.listOf unitNameType; description = lib.mdDoc '' Configures dependencies similar to Wants=, but as long as this unit is up, all units listed in Upholds= are started whenever found to be inactive or failed, and no job is queued for them. While a Wants= dependency on another unit has a one-time effect when this units started, a Upholds= dependency on it has a continuous effect, constantly restarting the unit if necessary. This is an alternative to the Restart= setting of service units, to ensure they are kept running whatever happens. The restart happens without delay, and usual per-unit rate-limit applies. ''; }; after = mkOption { default = []; type = types.listOf unitNameType; Loading Loading
nixos/lib/systemd-lib.nix +9 −1 Original line number Diff line number Diff line Loading @@ -242,7 +242,7 @@ in rec { ln -sfn '${name}' $out/'${name2}' '') (unit.aliases or [])) units)} # Create .wants and .requires symlinks from the wantedBy and # Create .wants, .upholds and .requires symlinks from the wantedBy, upheldBy and # requiredBy options. ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' Loading @@ -250,6 +250,12 @@ in rec { ln -sfn '../${name}' $out/'${name2}.wants'/ '') (unit.wantedBy or [])) units)} ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' mkdir -p $out/'${name2}.upholds' ln -sfn '../${name}' $out/'${name2}.upholds'/ '') (unit.upheldBy or [])) units)} ${concatStrings (mapAttrsToList (name: unit: concatMapStrings (name2: '' mkdir -p $out/'${name2}.requires' Loading Loading @@ -289,6 +295,8 @@ in rec { { Requires = toString config.requires; } // optionalAttrs (config.wants != []) { Wants = toString config.wants; } // optionalAttrs (config.upholds != []) { Upholds = toString config.upholds; } // optionalAttrs (config.after != []) { After = toString config.after; } // optionalAttrs (config.before != []) Loading
nixos/lib/systemd-unit-options.nix +23 −0 Original line number Diff line number Diff line Loading @@ -74,6 +74,15 @@ in rec { ''; }; upheldBy = mkOption { default = []; type = types.listOf unitNameType; description = lib.mdDoc '' Keep this unit running as long as the listed units are running. This is a continuously enforced version of wantedBy. ''; }; wantedBy = mkOption { default = []; type = types.listOf unitNameType; Loading Loading @@ -147,6 +156,20 @@ in rec { ''; }; upholds = mkOption { default = []; type = types.listOf unitNameType; description = lib.mdDoc '' Configures dependencies similar to Wants=, but as long as this unit is up, all units listed in Upholds= are started whenever found to be inactive or failed, and no job is queued for them. While a Wants= dependency on another unit has a one-time effect when this units started, a Upholds= dependency on it has a continuous effect, constantly restarting the unit if necessary. This is an alternative to the Restart= setting of service units, to ensure they are kept running whatever happens. The restart happens without delay, and usual per-unit rate-limit applies. ''; }; after = mkOption { default = []; type = types.listOf unitNameType; Loading