summaryrefslogtreecommitdiffstats
path: root/4lib/tv
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2015-07-23 01:56:46 +0200
committertv <tv@krebsco.de>2015-07-23 01:56:46 +0200
commit039f3193b75e78cc133409b69fb9784ce001ad57 (patch)
treef233d8ab56ca16dd2c2953aca202848726ac4904 /4lib/tv
parent8409890bfd7e79fcbe49a328fb79db5fa00d65cc (diff)
4 tv: generate tinc config
Diffstat (limited to '4lib/tv')
-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 ec46d8e..5eb9ac4 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;
+ };
+ };
+ };
};
};
});