summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorWilliam A. Kennington III <william@wkennington.com>2014-09-15 20:03:20 -0700
committerWilliam A. Kennington III <william@wkennington.com>2014-09-15 20:04:49 -0700
commit4d193b7262b7302e29322c41de70eb700323ed96 (patch)
tree2ccee6045cf62eee5f93bd3666e3f0f31ca6116a /nixos/modules/system
parentc27594d8b4a2f7e3cf035e0494322b7728f43a41 (diff)
downloadnixlib-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.nix9
-rw-r--r--nixos/modules/system/boot/systemd.nix6
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