diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-11-04 14:03:06 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-11-04 14:03:06 +0100 |
commit | 84c3acb643d94f3dc0432165691e1c31c8f7385f (patch) | |
tree | f6fdd44aebda940ada039d5e6de75d1e5c79642b /custom | |
parent | f487efb4775e80223b488222c09b719cda98a03e (diff) | |
download | nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar.gz nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar.bz2 nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar.xz nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.zip |
laeradhr
Diffstat (limited to 'custom')
-rw-r--r-- | custom/tinc/laeradhr.nix | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/custom/tinc/laeradhr.nix b/custom/tinc/laeradhr.nix index 7db4bec8..8471f020 100644 --- a/custom/tinc/laeradhr.nix +++ b/custom/tinc/laeradhr.nix | |||
@@ -1,36 +1,34 @@ | |||
1 | { config, pkgs, ... }: | 1 | { stdenv |
2 | , nettools | ||
3 | , openresolv | ||
4 | , name | ||
5 | , connect ? true | ||
6 | , ipConf ? {} | ||
7 | }: | ||
8 | |||
2 | 9 | ||
3 | let | 10 | let |
4 | name = "unknown"; | 11 | connectTo = if connect then "" else "ConnectTo = ymir"; |
5 | ip = "xxx.xxx.xxx.xxx"; | ||
6 | in { | 12 | in { |
7 | config.services.tinc = { | 13 | "laeradhr" = { |
8 | networks = { | 14 | inherit name; |
9 | "laeradhr" = { | 15 | debugLevel = 2; |
10 | name = name; | 16 | hosts = ( import ./laeradhr-hosts.nix ); |
11 | debugLevel = 2; | 17 | extraConfig = connectTo; |
12 | hosts = ( import ./laeradhr-hosts.nix ); | 18 | scripts = { |
13 | extraConfig = "ConnectTo = surtr"; | 19 | tinc-up = '' |
14 | scripts = { | 20 | #!${stdenv.shell} |
15 | tinc-up = '' | 21 | ${nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 |
16 | #!${pkgs.stdenv.shell} | 22 | ${openresolv}/bin/resolvconf -m 0 -a tinc.laeradhr <<EOF |
17 | ${pkgs.nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.142.0.2 dev $INTERFACE metric 9999 | 23 | domain yggdrasil |
18 | ${pkgs.openresolv}/bin/resolvconf -m 0 -a tinc.laeradhr <<EOF | 24 | nameserver 10.141.1.1 |
19 | domain yggdrasil | 25 | EOF |
20 | nameserver 10.141.1.1 | 26 | ''; |
21 | EOF''; | 27 | tinc-down = '' |
22 | tinc-down = '' | 28 | #!${stdenv.shell} |
23 | #!${pkgs.stdenv.shell} | 29 | ${openresolv}/bin/resolvconf -d tinc.laeradhr |
24 | ${pkgs.openresolv}/bin/resolvconf -d tinc.laeradhr''; | 30 | ''; |
25 | }; | 31 | }; |
26 | }; | 32 | interfaceConfig = ipConf; |
27 | }; | 33 | }; |
28 | }; | ||
29 | |||
30 | config.networking.interfaces."tinc.laeradhr" = { | ||
31 | useDHCP = false; | ||
32 | ip4 = [ | ||
33 | { address = ip; prefixLength = 16; } | ||
34 | ]; | ||
35 | }; | ||
36 | } | 34 | } |