diff options
Diffstat (limited to 'nixos/modules/system/boot/systemd.nix')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index ec5dea075bbce..1f2dd618698c6 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -25,9 +25,11 @@ let "nss-lookup.target" "nss-user-lookup.target" "time-sync.target" + ] ++ (optionals cfg.package.withCryptsetup [ "cryptsetup.target" "cryptsetup-pre.target" "remote-cryptsetup.target" + ]) ++ [ "sigpwr.target" "timers.target" "paths.target" @@ -210,20 +212,14 @@ let makeJobScript = name: text: let scriptName = replaceChars [ "\\" "@" ] [ "-" "_" ] (shellEscape name); - out = pkgs.writeTextFile { + out = (pkgs.writeShellScriptBin scriptName '' + set -e + ${text} + '').overrideAttrs (_: { # The derivation name is different from the script file name # to keep the script file name short to avoid cluttering logs. name = "unit-script-${scriptName}"; - executable = true; - destination = "/bin/${scriptName}"; - text = '' - #!${pkgs.runtimeShell} -e - ${text} - ''; - checkPhase = '' - ${pkgs.stdenv.shell} -n "$out/bin/${scriptName}" - ''; - }; + }); in "${out}/bin/${scriptName}"; unitConfig = { config, options, ... }: { @@ -247,6 +243,8 @@ let { Requisite = toString config.requisite; } // optionalAttrs (config.restartTriggers != []) { X-Restart-Triggers = toString config.restartTriggers; } + // optionalAttrs (config.reloadTriggers != []) + { X-Reload-Triggers = toString config.reloadTriggers; } // optionalAttrs (config.description != "") { Description = config.description; } // optionalAttrs (config.documentation != []) { @@ -921,6 +919,9 @@ in (optional hasDeprecated "Service '${name}.service' uses the attribute 'StartLimitInterval' in the Service section, which is deprecated. See https://github.com/NixOS/nixpkgs/issues/45786." ) + (optional (service.reloadIfChanged && service.reloadTriggers != []) + "Service '${name}.service' has both 'reloadIfChanged' and 'reloadTriggers' set. This is probably not what you want, because 'reloadTriggers' behave the same whay as 'restartTriggers' if 'reloadIfChanged' is set." + ) ] ) cfg.services |