From c9f0c17660a23faaa9fff1331b9c303f52b7c995 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 21 Dec 2021 21:57:21 +0100 Subject: tinc module: reload instead of restart remove enableLegacy option since reloading is dependant on /etc/tinc/ existing --- krebs/3modules/tinc.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'krebs/3modules/tinc.nix') diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index b12fe6050..3d0cc8fb4 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -17,7 +17,6 @@ let in { enable = mkEnableOption "krebs.tinc.${netname}" // { default = true; }; - enableLegacy = mkEnableOption "/etc/tinc/${netname}"; confDir = mkOption { type = types.package; @@ -263,9 +262,9 @@ let ) config.krebs.tinc; environment.etc = mapAttrs' (netname: cfg: - nameValuePair "tinc/${netname}" (mkIf cfg.enableLegacy { + nameValuePair "tinc/${netname}" { source = cfg.confDir; - }) + } ) config.krebs.tinc; systemd.services = mapAttrs (netname: cfg: @@ -287,9 +286,12 @@ let ]; wantedBy = [ "multi-user.target" ]; path = [ tinc iproute ]; + reloadIfChanged = true; + restartTriggers = [ cfg.confDir ]; serviceConfig = rec { Restart = "always"; - ExecStart = "${tinc}/sbin/tincd -c ${cfg.confDir} -d 0 -U ${cfg.user.name} -D --pidfile=/var/run/tinc.${SyslogIdentifier}.pid"; + ExecStart = "${tinc}/sbin/tincd -c /etc/tinc/${netname} -d 0 -U ${cfg.user.name} -D --pidfile=/var/run/tinc.${SyslogIdentifier}.pid"; + ExecReload = "${tinc}/sbin/tinc -n ${netname} reload"; SyslogIdentifier = netname; }; } -- cgit v1.2.3