summaryrefslogtreecommitdiffstats
path: root/4lib/tv/default.nix
diff options
context:
space:
mode:
authortv <tv@shackspace.de>2015-07-23 01:56:46 +0200
committertv <tv@shackspace.de>2015-07-23 01:56:46 +0200
commit7a40f89e01593adff35f943aa86492ac4281d4e8 (patch)
treef233d8ab56ca16dd2c2953aca202848726ac4904 /4lib/tv/default.nix
parentd97be4322371f06b423e308b606824c02f1a67af (diff)
4 tv: generate tinc config
Diffstat (limited to '4lib/tv/default.nix')
-rw-r--r--4lib/tv/default.nix23
1 files changed, 21 insertions, 2 deletions
diff --git a/4lib/tv/default.nix b/4lib/tv/default.nix
index ec46d8ea8..5eb9ac45f 100644
--- a/4lib/tv/default.nix
+++ b/4lib/tv/default.nix
@@ -76,6 +76,10 @@ builtins // lib // rec {
net = submodule ({ config, ... }: {
options = {
+ via = mkOption {
+ type = nullOr net;
+ default = null;
+ };
addrs = mkOption {
type = listOf addr;
apply = _: config.addrs4 ++ config.addrs6;
@@ -92,8 +96,23 @@ builtins // lib // rec {
# TODO nonEmptyListOf hostname
type = listOf hostname;
};
- tinc-key = mkOption {
- type = str;
+ tinc = mkOption {
+ type = submodule {
+ options = {
+ config = mkOption {
+ type = str;
+ apply = _: ''
+ ${optionalString (config.via != null)
+ (concatMapStringsSep "\n" (a: "Address = ${a}") config.via.addrs)}
+ ${concatMapStringsSep "\n" (a: "Subnet = ${a}") config.addrs}
+ ${config.tinc.pubkey}
+ '';
+ };
+ pubkey = mkOption {
+ type = str;
+ };
+ };
+ };
};
};
});