summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/tinc/yggdrasil.nix29
-rw-r--r--ymir.nix3
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
5let 5let
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 '';
26in { 7in {
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 };
diff --git a/ymir.nix b/ymir.nix
index 45c0668b..0c2d4c2b 100644
--- a/ymir.nix
+++ b/ymir.nix
@@ -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 };