From 942f57e79b6453d0efca677bf1094abc3a7f65d2 Mon Sep 17 00:00:00 2001 From: Poscat Date: Wed, 6 Oct 2021 17:53:04 +0800 Subject: [PATCH] nixos/acme: add an option for reloading systemd services after renewal --- nixos/modules/security/acme.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nixos/modules/security/acme.nix b/nixos/modules/security/acme.nix index cfbc8e91903e..88c5774d187c 100644 --- a/nixos/modules/security/acme.nix +++ b/nixos/modules/security/acme.nix @@ -314,6 +314,9 @@ let if [ -e renewed ]; then rm renewed ${data.postRun} + ${optionalString (data.reloadServices != []) + "systemctl --no-block try-reload-or-restart ${escapeShellArgs data.reloadServices}" + } fi ''); }; @@ -474,6 +477,15 @@ let description = "Group running the ACME client."; }; + reloadServices = mkOption { + type = types.listOf types.str; + default = []; + description = '' + The list of systemd services to call systemctl try-reload-or-restart + on. + ''; + }; + postRun = mkOption { type = types.lines; default = "";