summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-08-13 09:37:58 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-08-13 09:37:58 +0200
commit06f9bbbc78e0c9320037c5fb9d6bf740e3b81ee3 (patch)
tree3ae66bee342becab7508f6f1093b5bf74366b2bc
parenteae86f4f8dd611068223107fab1a6e79dd6dec85 (diff)
downloadnixos-06f9bbbc78e0c9320037c5fb9d6bf740e3b81ee3.tar
nixos-06f9bbbc78e0c9320037c5fb9d6bf740e3b81ee3.tar.gz
nixos-06f9bbbc78e0c9320037c5fb9d6bf740e3b81ee3.tar.bz2
nixos-06f9bbbc78e0c9320037c5fb9d6bf740e3b81ee3.tar.xz
nixos-06f9bbbc78e0c9320037c5fb9d6bf740e3b81ee3.zip
...
-rw-r--r--custom/tinc/def.nix15
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