From 4d193b7262b7302e29322c41de70eb700323ed96 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Mon, 15 Sep 2014 20:03:20 -0700 Subject: [PATCH] systemd: Support reload scripts --- nixos/modules/system/boot/systemd-unit-options.nix | 9 +++++++++ nixos/modules/system/boot/systemd.nix | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/nixos/modules/system/boot/systemd-unit-options.nix b/nixos/modules/system/boot/systemd-unit-options.nix index a6183c47eb1..48c3564ba07 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 e353e9246b0..f2f7989ab4d 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