diff options
Diffstat (limited to 'custom/tinc/laeradhr.nix')
-rw-r--r-- | custom/tinc/laeradhr.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/custom/tinc/laeradhr.nix b/custom/tinc/laeradhr.nix new file mode 100644 index 00000000..cf1b196d --- /dev/null +++ b/custom/tinc/laeradhr.nix | |||
@@ -0,0 +1,33 @@ | |||
1 | { config, pkgs, name, ip, ... }: | ||
2 | |||
3 | { | ||
4 | config.services.tinc = { | ||
5 | networks = { | ||
6 | "laeradhr" = { | ||
7 | name = name; | ||
8 | debugLevel = 2; | ||
9 | hosts = ( import ./laeradhr-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.142.0.2 dev $INTERFACE metric 9999 | ||
15 | ${pkgs.openresolv}/bin/resolvconf -m 0 -a tinc.laeradhr <<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.laeradhr''; | ||
22 | }; | ||
23 | }; | ||
24 | }; | ||
25 | }; | ||
26 | |||
27 | config.networking.interfaces."tinc.laeradhr" = { | ||
28 | useDHCP = false; | ||
29 | ip4 = [ | ||
30 | { address = ip; prefixLength = 16; } | ||
31 | ]; | ||
32 | }; | ||
33 | } | ||