diff options
Diffstat (limited to 'custom/tinc/yggdrasil.nix')
-rw-r--r-- | custom/tinc/yggdrasil.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/custom/tinc/yggdrasil.nix b/custom/tinc/yggdrasil.nix new file mode 100644 index 00000000..1d642840 --- /dev/null +++ b/custom/tinc/yggdrasil.nix | |||
@@ -0,0 +1,33 @@ | |||
1 | { config, pkgs, name, ip, ... }: | ||
2 | |||
3 | { | ||
4 | config.services.tinc = { | ||
5 | networks = { | ||
6 | "yggdrasil" = { | ||
7 | name = name; | ||
8 | debugLevel = 2; | ||
9 | hosts = ( import ./yggdrasil-hosts.nix ); | ||
10 | extraConfig = "ConnectTo = surtr"; | ||
11 | scripts = { | ||
12 | tinc-up = '' | ||
13 | #!${pkgs.stdenv.shell} | ||
14 | ${pkgs.nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 | ||
15 | ${pkgs.openresolv}/bin/resolvconf -m 0 -a tinc.yggdrasil <<EOF | ||
16 | domain yggdrasil | ||
17 | nameserver 10.141.1.1 | ||
18 | EOF''; | ||
19 | tinc-down = '' | ||
20 | #!${pkgs.stdenv.shell} | ||
21 | ${pkgs.openresolv}/bin/resolvconf -d tinc.yggdrasil''; | ||
22 | }; | ||
23 | }; | ||
24 | }; | ||
25 | }; | ||
26 | |||
27 | config.networking.interfaces."tinc.yggdrasil" = { | ||
28 | useDHCP = false; | ||
29 | ip4 = [ | ||
30 | { address = ip; prefixLength = 16; } | ||
31 | ]; | ||
32 | }; | ||
33 | } | ||