diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2015-07-02 20:48:08 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2015-07-02 20:48:08 +0200 |
commit | 17d901fdd0f0cbd6fddbca62bb4b4d835e9f059b (patch) | |
tree | a27f0391123c67239de909f3bd00679e5ee66d94 /custom/tinc/laeradhr.nix | |
parent | 18fb5f4e19249c725eaf816b4b71e9058ee12bf1 (diff) | |
download | nixos-17d901fdd0f0cbd6fddbca62bb4b4d835e9f059b.tar nixos-17d901fdd0f0cbd6fddbca62bb4b4d835e9f059b.tar.gz nixos-17d901fdd0f0cbd6fddbca62bb4b4d835e9f059b.tar.bz2 nixos-17d901fdd0f0cbd6fddbca62bb4b4d835e9f059b.tar.xz nixos-17d901fdd0f0cbd6fddbca62bb4b4d835e9f059b.zip |
First work an tinc
Diffstat (limited to 'custom/tinc/laeradhr.nix')
-rw-r--r-- | custom/tinc/laeradhr.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/custom/tinc/laeradhr.nix b/custom/tinc/laeradhr.nix new file mode 100644 index 00000000..cf1b196d --- /dev/null +++ b/custom/tinc/laeradhr.nix | |||
@@ -0,0 +1,33 @@ | |||
1 | { config, pkgs, name, ip, ... }: | ||
2 | |||
3 | { | ||
4 | config.services.tinc = { | ||
5 | networks = { | ||
6 | "laeradhr" = { | ||
7 | name = name; | ||
8 | debugLevel = 2; | ||
9 | hosts = ( import ./laeradhr-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.142.0.2 dev $INTERFACE metric 9999 | ||
15 | ${pkgs.openresolv}/bin/resolvconf -m 0 -a tinc.laeradhr <<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.laeradhr''; | ||
22 | }; | ||
23 | }; | ||
24 | }; | ||
25 | }; | ||
26 | |||
27 | config.networking.interfaces."tinc.laeradhr" = { | ||
28 | useDHCP = false; | ||
29 | ip4 = [ | ||
30 | { address = ip; prefixLength = 16; } | ||
31 | ]; | ||
32 | }; | ||
33 | } | ||