diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-10-31 16:59:15 +0100 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-10-31 16:59:15 +0100 |
commit | 3f5c903088bfe9b4c16821248f684a4252b394e5 (patch) | |
tree | fb23c4ecb2d39dc13518c34372f03987bab0e05d /custom/tinc | |
parent | 82bd2519b518fbbe94d7f4629f7199f3a0e130b9 (diff) | |
download | nixos-3f5c903088bfe9b4c16821248f684a4252b394e5.tar nixos-3f5c903088bfe9b4c16821248f684a4252b394e5.tar.gz nixos-3f5c903088bfe9b4c16821248f684a4252b394e5.tar.bz2 nixos-3f5c903088bfe9b4c16821248f684a4252b394e5.tar.xz nixos-3f5c903088bfe9b4c16821248f684a4252b394e5.zip |
cleanup
Diffstat (limited to 'custom/tinc')
-rw-r--r-- | custom/tinc/laeradhr.nix | 16 | ||||
-rw-r--r-- | custom/tinc/yggdrasil.nix | 13 |
2 files changed, 17 insertions, 12 deletions
diff --git a/custom/tinc/laeradhr.nix b/custom/tinc/laeradhr.nix index abf309f0..e66b273d 100644 --- a/custom/tinc/laeradhr.nix +++ b/custom/tinc/laeradhr.nix | |||
@@ -7,27 +7,31 @@ | |||
7 | , useDNS ? true | 7 | , useDNS ? true |
8 | }: | 8 | }: |
9 | 9 | ||
10 | with stdenv.lib; | ||
10 | 11 | ||
11 | let | 12 | { |
12 | connectTo = if connect then "" else "ConnectTo = ymir"; | ||
13 | in { | ||
14 | "laeradhr" = { | 13 | "laeradhr" = { |
15 | inherit name; | 14 | inherit name; |
16 | debugLevel = 2; | 15 | debugLevel = 2; |
17 | hosts = ( import ./hosts/laeradhr.nix ); | 16 | hosts = ( import ./hosts/laeradhr.nix ); |
18 | extraConfig = connectTo; | 17 | extraConfig = '' |
18 | ${optionalString connect "ConnectTo = ymir"} | ||
19 | ''; | ||
19 | scripts = { | 20 | scripts = { |
20 | tinc-up = '' | 21 | tinc-up = '' |
21 | #!${stdenv.shell} | 22 | #!${stdenv.shell} |
22 | ${nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 | 23 | ${nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 |
23 | ${if useDNS then ''${openresolv}/bin/resolvconf -m 0 -a tinc.laeradhr <<EOF | 24 | ${optionalString useDNS '' |
25 | ${openresolv}/bin/resolvconf -m 0 -a tinc.laeradhr <<EOF | ||
24 | domain yggdrasil | 26 | domain yggdrasil |
25 | nameserver 10.141.1.1 | 27 | nameserver 10.141.1.1 |
26 | EOF'' else ""} | 28 | EOF''} |
27 | ''; | 29 | ''; |
28 | tinc-down = '' | 30 | tinc-down = '' |
29 | #!${stdenv.shell} | 31 | #!${stdenv.shell} |
32 | ${optionalString useDNS '' | ||
30 | ${openresolv}/bin/resolvconf -d tinc.laeradhr | 33 | ${openresolv}/bin/resolvconf -d tinc.laeradhr |
34 | ''} | ||
31 | ''; | 35 | ''; |
32 | }; | 36 | }; |
33 | interfaceConfig = ipConf; | 37 | interfaceConfig = ipConf; |
diff --git a/custom/tinc/yggdrasil.nix b/custom/tinc/yggdrasil.nix index 23f94a64..2e5a2442 100644 --- a/custom/tinc/yggdrasil.nix +++ b/custom/tinc/yggdrasil.nix | |||
@@ -7,31 +7,32 @@ | |||
7 | , useDNS ? true | 7 | , useDNS ? true |
8 | }: | 8 | }: |
9 | 9 | ||
10 | with stdenv.lib; | ||
10 | 11 | ||
11 | let | 12 | { |
12 | connectTo = if connect then "ConnectTo = ymir" else ""; | ||
13 | in { | ||
14 | "yggdrasil" = { | 13 | "yggdrasil" = { |
15 | inherit name; | 14 | inherit name; |
16 | debugLevel = 2; | 15 | debugLevel = 2; |
17 | hosts = ( import ./hosts/yggdrasil.nix ); | 16 | hosts = ( import ./hosts/yggdrasil.nix ); |
18 | extraConfig = '' | 17 | extraConfig = '' |
19 | PingTimeout = 10 | 18 | PingTimeout = 10 |
20 | ${connectTo} | 19 | ${optionalString connect "ConnectTo = ymir"} |
21 | ''; | 20 | ''; |
22 | scripts = { | 21 | scripts = { |
23 | tinc-up = '' | 22 | tinc-up = '' |
24 | #!${stdenv.shell} | 23 | #!${stdenv.shell} |
25 | ${nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 | 24 | ${nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 |
26 | ${if useDNS then '' | 25 | ${optionalString useDNS '' |
27 | ${openresolv}/bin/resolvconf -m 0 -a tinc.yggdrasil <<EOF | 26 | ${openresolv}/bin/resolvconf -m 0 -a tinc.yggdrasil <<EOF |
28 | domain yggdrasil | 27 | domain yggdrasil |
29 | nameserver 10.141.1.1 | 28 | nameserver 10.141.1.1 |
30 | EOF'' else ""} | 29 | EOF''} |
31 | ''; | 30 | ''; |
32 | tinc-down = '' | 31 | tinc-down = '' |
33 | #!${stdenv.shell} | 32 | #!${stdenv.shell} |
33 | ${optionalString useDNS '' | ||
34 | ${openresolv}/bin/resolvconf -d tinc.yggdrasil | 34 | ${openresolv}/bin/resolvconf -d tinc.yggdrasil |
35 | ''} | ||
35 | ''; | 36 | ''; |
36 | }; | 37 | }; |
37 | interfaceConfig = ipConf; | 38 | interfaceConfig = ipConf; |