don't restart tinc

This commit is contained in:
Jörg Thalheim 2020-11-01 09:30:04 +01:00
parent 37338af4b2
commit e90be25da2
No known key found for this signature in database
GPG Key ID: 003F2096411B5F92
1 changed files with 17 additions and 8 deletions

View File

@ -5,7 +5,6 @@ with lib;
let let
netname = "retiolum"; netname = "retiolum";
cfg = config.networking.retiolum; cfg = config.networking.retiolum;
in { in {
options = { options = {
networking.retiolum.ipv4 = mkOption { networking.retiolum.ipv4 = mkOption {
@ -45,14 +44,24 @@ in {
networking.extraHosts = builtins.readFile ../../etc.hosts; networking.extraHosts = builtins.readFile ../../etc.hosts;
environment.systemPackages = [ config.services.tinc.networks.${netname}.package ]; environment.systemPackages = [
config.services.tinc.networks.${netname}.package
];
systemd.services."tinc.${netname}".preStart = '' systemd.services."tinc.${netname}-host-keys" = {
rm -rf /etc/tinc/${netname}/hosts description = "Install tinc.${netname} host keys";
cp -R ${../../hosts} /etc/tinc/${netname}/hosts requiredBy = [ "tinc.${netname}" ];
chown -R tinc.${netname} /etc/tinc/${netname}/hosts before = [ "tinc.${netname}" ];
chmod -R u+w /etc/tinc/${netname}/hosts script = ''
''; rm -rf /etc/tinc/${netname}/hosts
cp -R ${../../hosts} /etc/tinc/${netname}/hosts
chown -R tinc.${netname} /etc/tinc/${netname}/hosts
chmod -R u+w /etc/tinc/${netname}/hosts
'';
};
# Some hosts require VPN for nixos-rebuild, so we don't want to restart it on update
systemd.services."tinc.${netname}".restartIfChanged = false;
networking.firewall.allowedTCPPorts = [ 655 ]; networking.firewall.allowedTCPPorts = [ 655 ];
networking.firewall.allowedUDPPorts = [ 655 ]; networking.firewall.allowedUDPPorts = [ 655 ];