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
netname = "retiolum";
cfg = config.networking.retiolum;
in {
options = {
networking.retiolum.ipv4 = mkOption {
@ -45,14 +44,24 @@ in {
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 = ''
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
'';
systemd.services."tinc.${netname}-host-keys" = {
description = "Install tinc.${netname} host keys";
requiredBy = [ "tinc.${netname}" ];
before = [ "tinc.${netname}" ];
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.allowedUDPPorts = [ 655 ];