diff options
author | William A. Kennington III <william@wkennington.com> | 2014-09-15 20:03:20 -0700 |
---|---|---|
committer | William A. Kennington III <william@wkennington.com> | 2014-09-15 20:04:49 -0700 |
commit | 4d193b7262b7302e29322c41de70eb700323ed96 (patch) | |
tree | 2ccee6045cf62eee5f93bd3666e3f0f31ca6116a /nixos/modules/system | |
parent | c27594d8b4a2f7e3cf035e0494322b7728f43a41 (diff) | |
download | nixlib-4d193b7262b7302e29322c41de70eb700323ed96.tar nixlib-4d193b7262b7302e29322c41de70eb700323ed96.tar.gz nixlib-4d193b7262b7302e29322c41de70eb700323ed96.tar.bz2 nixlib-4d193b7262b7302e29322c41de70eb700323ed96.tar.lz nixlib-4d193b7262b7302e29322c41de70eb700323ed96.tar.xz nixlib-4d193b7262b7302e29322c41de70eb700323ed96.tar.zst nixlib-4d193b7262b7302e29322c41de70eb700323ed96.zip |
systemd: Support reload scripts
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/systemd-unit-options.nix | 9 | ||||
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 6 |
2 files changed, 15 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index a6183c47eb1b..48c3564ba078 100644 --- a/nixos/modules/system/boot/systemd-unit-options.nix +++ b/nixos/modules/system/boot/systemd-unit-options.nix @@ -230,6 +230,15 @@ in rec { ''; }; + reload = mkOption { + type = types.lines; + default = ""; + description = '' + Shell commands executed when the service's main process + is reloaded. + ''; + }; + preStop = mkOption { type = types.lines; default = ""; diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index e353e9246b0e..f2f7989ab4de 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -245,6 +245,12 @@ let ${config.postStart} ''; }) + (mkIf (config.reload != "") + { serviceConfig.ExecReload = makeJobScript "${name}-reload" '' + #! ${pkgs.stdenv.shell} -e + ${config.reload} + ''; + }) (mkIf (config.preStop != "") { serviceConfig.ExecStop = makeJobScript "${name}-pre-stop" '' #! ${pkgs.stdenv.shell} -e |