diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/tinc/def.nix | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/custom/tinc/def.nix b/custom/tinc/def.nix index 3a6dcfa8..7e7e83b2 100644 --- a/custom/tinc/def.nix +++ b/custom/tinc/def.nix | |||
@@ -124,11 +124,9 @@ in | |||
124 | )) // { | 124 | )) // { |
125 | "tinc/${network}/tinc.conf" = { | 125 | "tinc/${network}/tinc.conf" = { |
126 | text = '' | 126 | text = '' |
127 | Name = ${if data.name == null then "$HOST" else data.name} | 127 | Name = ${if data.name == null then config.networking.hostName else data.name} |
128 | DeviceType = ${data.interfaceType} | 128 | DeviceType = ${data.interfaceType} |
129 | Device = /dev/net/tun | ||
130 | Interface = ${network} | 129 | Interface = ${network} |
131 | ExperimentalProtocol = no | ||
132 | ${data.extraConfig} | 130 | ${data.extraConfig} |
133 | ''; | 131 | ''; |
134 | }; | 132 | }; |
@@ -137,12 +135,11 @@ in | |||
137 | 135 | ||
138 | environment.systemPackages = mapAttrsToList (_: data: data.package) cfg.networks; | 136 | environment.systemPackages = mapAttrsToList (_: data: data.package) cfg.networks; |
139 | 137 | ||
140 | networking.interfaces = flip mapAttrs' cfg.networks (network: data: nameValuePair | 138 | networking.interfaces = flip mapAttrs cfg.networks (network: data: |
141 | (network) | 139 | { |
142 | ({ | ||
143 | virtual = true; | 140 | virtual = true; |
144 | virtualType = "${data.interfaceType}"; | 141 | virtualType = "${data.interfaceType}"; |
145 | } // data.interfaceConfig) | 142 | } // data.interfaceConfig |
146 | ); | 143 | ); |
147 | 144 | ||
148 | networking.networkmanager.dispatcherScripts = concatLists (flip mapAttrsToList cfg.networks (network: data: optional data.nmDispatch { | 145 | networking.networkmanager.dispatcherScripts = concatLists (flip mapAttrsToList cfg.networks (network: data: optional data.nmDispatch { |
@@ -154,7 +151,7 @@ in | |||
154 | 151 | ||
155 | case "''${2}" in | 152 | case "''${2}" in |
156 | (?(vpn-)up) | 153 | (?(vpn-)up) |
157 | ${pkgs.systemd}/bin/systemctl --signal=ALRM --kill-who=main kill "tinc.${network}.service" | 154 | ${data.package}/bin/tinc -n ${network} --pidfile /run/tinc.${network}.pid retry |
158 | ;; | 155 | ;; |
159 | esac | 156 | esac |
160 | ''; | 157 | ''; |
@@ -176,8 +173,6 @@ in | |||
176 | ''; | 173 | ''; |
177 | }; | 174 | }; |
178 | preStart = '' | 175 | preStart = '' |
179 | ${pkgs.openresolv}/bin/resolvconf -d tinc.${network} || true | ||
180 | |||
181 | mkdir -p /etc/tinc/${network}/hosts | 176 | mkdir -p /etc/tinc/${network}/hosts |
182 | 177 | ||
183 | # Determine how we should generate our keys | 178 | # Determine how we should generate our keys |