summaryrefslogtreecommitdiff
path: root/custom/tinc/yggdrasil.nix
diff options
context:
space:
mode:
Diffstat (limited to 'custom/tinc/yggdrasil.nix')
-rw-r--r--custom/tinc/yggdrasil.nix57
1 files changed, 30 insertions, 27 deletions
diff --git a/custom/tinc/yggdrasil.nix b/custom/tinc/yggdrasil.nix
index 4c19e0e7..a4309278 100644
--- a/custom/tinc/yggdrasil.nix
+++ b/custom/tinc/yggdrasil.nix
@@ -1,30 +1,33 @@
1{ config, pkgs, name, ip }: 1{ stdenv
2, nettools
3, openresolv
4, connect ? true
5, ipConf ? {}
6}
2 7
3{
4 config.services.tinc = {
5 networks = {
6 "yggdrasil" = {
7 name = name;
8 debugLevel = 2;
9 hosts = ( import ./yggdrasil-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.141.1.1 dev $INTERFACE metric 9999
15 ${pkgs.openresolv}/bin/resolvconf -m 0 -a tinc.yggdrasil <<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.yggdrasil'';
22 };
23 };
24 };
25 };
26 8
27 config.networking.interfaces."tinc.yggdrasil" = { 9let
28 useDHCP = false; 10 connectTo = if connect then "" else "ConnectTo = ymir"
29 } // ip; 11{
12 "yggdrasil" = {
13 name = name;
14 debugLevel = 2;
15 hosts = ( import ./yggdrasil-hosts.nix );
16 extraConfig = connectTo;
17 scripts = {
18 tinc-up = ''
19 #!${stdenv.shell}
20 ${nettools}/bin/route add -net 10.141.1.0 netmask 255.255.255.0 gw 10.141.1.1 dev $INTERFACE metric 9999
21 ${openresolv}/bin/resolvconf -m 0 -a tinc.yggdrasil <<EOF
22 domain yggdrasil
23 nameserver 10.141.1.1
24 EOF
25 '';
26 tinc-down = ''
27 #!${stdenv.shell}
28 ${openresolv}/bin/resolvconf -d tinc.yggdrasil
29 '';
30 };
31 interfaceConfig = ipConf;
32 };
30} 33}