summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-11-04 14:03:06 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2015-11-04 14:03:06 +0100
commit84c3acb643d94f3dc0432165691e1c31c8f7385f (patch)
treef6fdd44aebda940ada039d5e6de75d1e5c79642b
parentf487efb4775e80223b488222c09b719cda98a03e (diff)
downloadnixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar
nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar.gz
nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar.bz2
nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.tar.xz
nixos-84c3acb643d94f3dc0432165691e1c31c8f7385f.zip
laeradhr
-rw-r--r--custom/tinc/laeradhr.nix62
-rw-r--r--ymir.nix8
2 files changed, 38 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
3let 10let
4 name = "unknown"; 11 connectTo = if connect then "" else "ConnectTo = ymir";
5 ip = "xxx.xxx.xxx.xxx";
6in { 12in {
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}
diff --git a/ymir.nix b/ymir.nix
index 502e608b..69e18b72 100644
--- a/ymir.nix
+++ b/ymir.nix
@@ -152,5 +152,13 @@ in {
152 ipConf = { 152 ipConf = {
153 ip4 = [ { address = "10.141.4.1"; prefixLength = 16; } ]; 153 ip4 = [ { address = "10.141.4.1"; prefixLength = 16; } ];
154 }; 154 };
155 })
156 // ((import ./custom/tinc/laeradhr.nix) {
157 inherit (pkgs) stdenv nettools openresolv;
158 name = "ymir";
159 connect = false;
160 ipConf = {
161 ip4 = [ { address = "10.142.0.3"; prefixLength = 16; } ];
162 };
155 }); 163 });
156} 164}