Loading nixos/lib/systemd-lib.nix +29 −30 Original line number Diff line number Diff line Loading @@ -360,9 +360,13 @@ in rec { }; }; commonUnitText = def: '' commonUnitText = def: lines: '' [Unit] ${attrsToSection def.unitConfig} '' + lines + lib.optionalString (def.wantedBy != [ ]) '' [Install] WantedBy=${concatStringsSep " " def.wantedBy} ''; targetToUnit = name: def: Loading @@ -376,7 +380,7 @@ in rec { serviceToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def ('' [Service] '' + (let env = cfg.globalEnvironment // def.environment; in concatMapStrings (n: Loading @@ -392,13 +396,12 @@ in rec { '' else "") + optionalString (def ? stopIfChanged && !def.stopIfChanged) '' X-StopIfChanged=false '' + attrsToSection def.serviceConfig; '' + attrsToSection def.serviceConfig); }; socketToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Socket] ${attrsToSection def.socketConfig} ${concatStringsSep "\n" (map (s: "ListenStream=${s}") def.listenStreams)} Loading @@ -408,8 +411,7 @@ in rec { timerToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Timer] ${attrsToSection def.timerConfig} ''; Loading @@ -417,8 +419,7 @@ in rec { pathToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Path] ${attrsToSection def.pathConfig} ''; Loading @@ -426,8 +427,7 @@ in rec { mountToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Mount] ${attrsToSection def.mountConfig} ''; Loading @@ -444,8 +444,7 @@ in rec { sliceToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Slice] ${attrsToSection def.sliceConfig} ''; Loading Loading
nixos/lib/systemd-lib.nix +29 −30 Original line number Diff line number Diff line Loading @@ -360,9 +360,13 @@ in rec { }; }; commonUnitText = def: '' commonUnitText = def: lines: '' [Unit] ${attrsToSection def.unitConfig} '' + lines + lib.optionalString (def.wantedBy != [ ]) '' [Install] WantedBy=${concatStringsSep " " def.wantedBy} ''; targetToUnit = name: def: Loading @@ -376,7 +380,7 @@ in rec { serviceToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def ('' [Service] '' + (let env = cfg.globalEnvironment // def.environment; in concatMapStrings (n: Loading @@ -392,13 +396,12 @@ in rec { '' else "") + optionalString (def ? stopIfChanged && !def.stopIfChanged) '' X-StopIfChanged=false '' + attrsToSection def.serviceConfig; '' + attrsToSection def.serviceConfig); }; socketToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Socket] ${attrsToSection def.socketConfig} ${concatStringsSep "\n" (map (s: "ListenStream=${s}") def.listenStreams)} Loading @@ -408,8 +411,7 @@ in rec { timerToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Timer] ${attrsToSection def.timerConfig} ''; Loading @@ -417,8 +419,7 @@ in rec { pathToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Path] ${attrsToSection def.pathConfig} ''; Loading @@ -426,8 +427,7 @@ in rec { mountToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Mount] ${attrsToSection def.mountConfig} ''; Loading @@ -444,8 +444,7 @@ in rec { sliceToUnit = name: def: { inherit (def) aliases wantedBy requiredBy enable overrideStrategy; text = commonUnitText def + '' text = commonUnitText def '' [Slice] ${attrsToSection def.sliceConfig} ''; Loading