diff options
author | Minijackson <minijackson@riseup.net> | 2020-12-03 16:45:06 +0100 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2020-12-03 16:45:06 +0100 |
commit | 3f0e83cb4816e637d8c916fb77217e1c5824dbe5 (patch) | |
tree | 65b48ffe6e82459cde97b8ee61a597402ba2617b /common/tinc.nix | |
download | nixos-config-reborn-3f0e83cb4816e637d8c916fb77217e1c5824dbe5.tar.gz nixos-config-reborn-3f0e83cb4816e637d8c916fb77217e1c5824dbe5.zip |
initial commit: most of previous configuration reworked
Diffstat (limited to 'common/tinc.nix')
-rw-r--r-- | common/tinc.nix | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/tinc.nix b/common/tinc.nix new file mode 100644 index 0000000..1016f42 --- /dev/null +++ b/common/tinc.nix | |||
@@ -0,0 +1,18 @@ | |||
1 | { config, lib, ... }: | ||
2 | |||
3 | with lib; | ||
4 | with builtins; | ||
5 | let | ||
6 | networks = attrNames (readDir ./tinc/private); | ||
7 | in { | ||
8 | imports = map (network: (./tinc/private + "/${network}")) networks; | ||
9 | |||
10 | services.tinc.networks = genAttrs networks (network: { | ||
11 | name = config.networking.hostName; | ||
12 | |||
13 | hosts = let | ||
14 | hosts = attrNames (readDir (./tinc/private + "/${network}/hosts")); | ||
15 | config = hostname: readFile (./tinc/private + "/${network}/hosts/${hostname}"); | ||
16 | in genAttrs hosts config; | ||
17 | }); | ||
18 | } | ||