diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-23 11:57:23 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-23 11:57:23 +0200 |
commit | 228b191389b989dcbec609e52371f0dda33ef51b (patch) | |
tree | 740b0bc67ccc573e12a6bc0ba5e17de3ab1ed09a | |
parent | 6e61f94862f07b46c7454157c40fbef6cc27ef4c (diff) | |
download | nixos-228b191389b989dcbec609e52371f0dda33ef51b.tar nixos-228b191389b989dcbec609e52371f0dda33ef51b.tar.gz nixos-228b191389b989dcbec609e52371f0dda33ef51b.tar.bz2 nixos-228b191389b989dcbec609e52371f0dda33ef51b.tar.xz nixos-228b191389b989dcbec609e52371f0dda33ef51b.zip |
dns via dhcp
-rw-r--r-- | custom/tinc/yggdrasil.nix | 29 | ||||
-rw-r--r-- | ymir.nix | 3 |
2 files changed, 3 insertions, 29 deletions
diff --git a/custom/tinc/yggdrasil.nix b/custom/tinc/yggdrasil.nix index 34933a19..2caa74a0 100644 --- a/custom/tinc/yggdrasil.nix +++ b/custom/tinc/yggdrasil.nix | |||
@@ -4,25 +4,6 @@ with lib; | |||
4 | 4 | ||
5 | let | 5 | let |
6 | cfg = config.services.yggdrasilTinc; | 6 | cfg = config.services.yggdrasilTinc; |
7 | |||
8 | heimdallr-up = pkgs.writeScript "heimdallr-up.sh" '' | ||
9 | #!${pkgs.stdenv.shell} | ||
10 | ${pkgs.nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999 | ||
11 | ${optionalString cfg.useDNS '' | ||
12 | ${pkgs.openresolv}/bin/resolvconf -m 0 -a yggdrasil <<EOF | ||
13 | domain yggdrasil | ||
14 | nameserver 10.141.1.1 | ||
15 | EOF | ||
16 | ''} | ||
17 | ''; | ||
18 | |||
19 | heimdallr-down = pkgs.writeScript "heimdallr-down.sh" '' | ||
20 | #!${pkgs.stdenv.shell} | ||
21 | ${pkgs.nettools}/bin/route del -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE | ||
22 | ${optionalString cfg.useDNS '' | ||
23 | ${pkgs.openresolv}/bin/resolvconf -d yggdrasil | ||
24 | ''} | ||
25 | ''; | ||
26 | in { | 7 | in { |
27 | options = { | 8 | options = { |
28 | services.yggdrasilTinc = { | 9 | services.yggdrasilTinc = { |
@@ -87,16 +68,6 @@ in { | |||
87 | MACFILE="/var/db/$NETNAME.mac" | 68 | MACFILE="/var/db/$NETNAME.mac" |
88 | [ -e $MACFILE ] && ${pkgs.iproute}/bin/ip link set dev $INTERFACE address `cat $MACFILE` || cat /sys/class/net/$INTERFACE/address >$MACFILE | 69 | [ -e $MACFILE ] && ${pkgs.iproute}/bin/ip link set dev $INTERFACE address `cat $MACFILE` || cat /sys/class/net/$INTERFACE/address >$MACFILE |
89 | ''; | 70 | ''; |
90 | "hosts/heimdallr-up" = '' | ||
91 | #!${pkgs.stdenv.shell} | ||
92 | |||
93 | exec ${config.security.wrapperDir}/sudo -En ${heimdallr-up} | ||
94 | ''; | ||
95 | "hosts/heimdallr-down" = '' | ||
96 | #!${pkgs.stdenv.shell} | ||
97 | |||
98 | exec ${config.security.wrapperDir}/sudo -En ${heimdallr-down} | ||
99 | ''; | ||
100 | }; | 71 | }; |
101 | }; | 72 | }; |
102 | }; | 73 | }; |
@@ -928,6 +928,9 @@ in rec { | |||
928 | 928 | ||
929 | option rfc3442-classless-static-routes 24, 10, 141, 4, 10, 141, 1, 5, 24, 10, 141, 1, 10, 141, 1, 1; | 929 | option rfc3442-classless-static-routes 24, 10, 141, 4, 10, 141, 1, 5, 24, 10, 141, 1, 10, 141, 1, 1; |
930 | option ms-classless-static-routes 24, 10, 141, 4, 10, 141, 1, 5, 24, 10, 141, 1, 10, 141, 1, 1; | 930 | option ms-classless-static-routes 24, 10, 141, 4, 10, 141, 1, 5, 24, 10, 141, 1, 10, 141, 1, 1; |
931 | |||
932 | option domain-name "yggdrasil"; | ||
933 | option domain-name-servers 10.141.1.1, 8.8.8.8, 8.8.4.4; | ||
931 | } | 934 | } |
932 | ''; | 935 | ''; |
933 | }; | 936 | }; |