nixos/services.tinc: Add all generated /etc/ files to reloadTriggers
Bug fix for issue #66431. Adds all files created as a result of hostSettings configuration to the created service's reloadTriggers, or to restartTriggers if the version of tinc isn't 1.1pre or later.
This commit is contained in:
parent
81f1863ca7
commit
ca591e7008
@ -349,9 +349,9 @@ in
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf (cfg.networks != { }) {
|
config = mkIf (cfg.networks != { }) (
|
||||||
|
let
|
||||||
environment.etc = foldr (a: b: a // b) { }
|
etcConfig = foldr (a: b: a // b) { }
|
||||||
(flip mapAttrsToList cfg.networks (network: data:
|
(flip mapAttrsToList cfg.networks (network: data:
|
||||||
flip mapAttrs' data.hosts (host: text: nameValuePair
|
flip mapAttrs' data.hosts (host: text: nameValuePair
|
||||||
("tinc/${network}/hosts/${host}")
|
("tinc/${network}/hosts/${host}")
|
||||||
@ -366,19 +366,22 @@ in
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
in {
|
||||||
|
environment.etc = etcConfig;
|
||||||
|
|
||||||
systemd.services = flip mapAttrs' cfg.networks (network: data: nameValuePair
|
systemd.services = flip mapAttrs' cfg.networks (network: data: nameValuePair
|
||||||
("tinc.${network}")
|
("tinc.${network}")
|
||||||
({
|
(let version = getVersion data.package; in {
|
||||||
description = "Tinc Daemon - ${network}";
|
description = "Tinc Daemon - ${network}";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = [ data.package ];
|
path = [ data.package ];
|
||||||
restartTriggers = [ config.environment.etc."tinc/${network}/tinc.conf".source ];
|
reloadTriggers = mkIf (versionAtLeast version "1.1pre") [ (builtins.toJSON etcConfig) ];
|
||||||
|
restartTriggers = mkIf (versionOlder version "1.1pre") [ (builtins.toJSON etcConfig) ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = "3";
|
RestartSec = "3";
|
||||||
ExecReload = mkIf (versionAtLeast (getVersion data.package) "1.1pre") "${data.package}/bin/tinc -n ${network} reload";
|
ExecReload = mkIf (versionAtLeast version "1.1pre") "${data.package}/bin/tinc -n ${network} reload";
|
||||||
ExecStart = "${data.package}/bin/tincd -D -U tinc.${network} -n ${network} ${optionalString (data.chroot) "-R"} --pidfile /run/tinc.${network}.pid -d ${toString data.debugLevel}";
|
ExecStart = "${data.package}/bin/tincd -D -U tinc.${network} -n ${network} ${optionalString (data.chroot) "-R"} --pidfile /run/tinc.${network}.pid -d ${toString data.debugLevel}";
|
||||||
};
|
};
|
||||||
preStart = ''
|
preStart = ''
|
||||||
@ -433,7 +436,7 @@ in
|
|||||||
users.groups = flip mapAttrs' cfg.networks (network: _:
|
users.groups = flip mapAttrs' cfg.networks (network: _:
|
||||||
nameValuePair "tinc.${network}" {}
|
nameValuePair "tinc.${network}" {}
|
||||||
);
|
);
|
||||||
};
|
});
|
||||||
|
|
||||||
meta.maintainers = with maintainers; [ minijackson mic92 ];
|
meta.maintainers = with maintainers; [ minijackson mic92 ];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user