diff options
| author | makefu <github@syntax-fehler.de> | 2026-02-11 22:13:33 +0100 |
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2026-02-11 22:13:33 +0100 |
| commit | 490e66008b3e2837589d0c60ecfb3358fbfb089d (patch) | |
| tree | bea05b1e1c97dc2d74e5a871941381784e74cfba /lib/types.nix | |
| parent | dce904dd1a33c8a2ca9f56b0f33f85f493eda499 (diff) | |
| parent | 0122ded2137e568e771e753c0c3a17b1b20d9ca7 (diff) | |
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'lib/types.nix')
| -rw-r--r-- | lib/types.nix | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/types.nix b/lib/types.nix index ad8421b18..f0165c523 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -1,5 +1,4 @@ { lib, ... }: - let inherit (lib) all any attrNames concatMapStringsSep concatStringsSep const filter flip @@ -198,9 +197,32 @@ rec { }; tinc = mkOption { type = let net = config; in nullOr (submodule ({ config, ... }: { + config = { + config = + #assert (with builtins; trace "xxxxxx ${toJSON config.subnets}" true); + concatStringsSep "\n" ( + (optionals (net.via != null) + (map (a: "Address = ${a} ${toString config.port}") net.via.addrs)) + ++ + (map (a: "Subnet = ${a}") config.subnets) + ++ + (map (a: "Subnet = ${a}") net.addrs) + ++ + [config.extraConfig] + ++ + [config.pubkey] + ++ + optional (config.pubkey_ed25519 != null) '' + Ed25519PublicKey = ${config.pubkey_ed25519} + '' + ++ + optional (config.weight != null) "Weight = ${toString config.weight}" + ); + }; options = { config = mkOption { type = str; + # TODO: readOnly = true; default = concatStringsSep "\n" ( (optionals (net.via != null) (map (a: "Address = ${a} ${toString config.port}") net.via.addrs)) |
