summaryrefslogtreecommitdiffstats
path: root/common/tinc.nix
diff options
context:
space:
mode:
Diffstat (limited to 'common/tinc.nix')
-rw-r--r--common/tinc.nix18
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
3with lib;
4with builtins;
5let
6 networks = attrNames (readDir ./tinc/private);
7in {
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}