From 7a40f89e01593adff35f943aa86492ac4281d4e8 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 23 Jul 2015 01:56:46 +0200 Subject: 4 tv: generate tinc config --- 4lib/tv/default.nix | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to '4lib') 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; + }; + }; + }; }; }; }); -- cgit v1.2.3 [cgit] Unable to lock slot /tmp/cgit/98000000.lock: No such file or directory (2)