diff options
author | tv <tv@krebsco.de> | 2022-11-23 17:08:55 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2022-11-23 19:15:49 +0100 |
commit | fe2262d70618880de6f37ba15449b9be67bc5ec6 (patch) | |
tree | 56460143c3b6dc1cc82e431396ed8775aecec1c3 /lib/types.nix | |
parent | a278a6503bf1c8de8e233f72faa442baaab29ab0 (diff) |
lib.types.net.ip*: add net-independent defaults
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/types.nix b/lib/types.nix index 0e0e093fb..67a0c6f1b 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -136,7 +136,7 @@ rec { default = null; }; ip4 = mkOption { - type = nullOr (submodule { + type = nullOr (submodule (ip4: { options = { addr = mkOption { type = addr4; @@ -146,13 +146,15 @@ rec { } // { retiolum.default = "10.243.0.0/16"; wiregrill.default = "10.244.0.0/16"; - }.${config._module.args.name} or {}); + }.${config._module.args.name} or { + default = "${ip4.config.addr}/32"; + }); }; - }); + })); default = null; }; ip6 = mkOption { - type = nullOr (submodule { + type = nullOr (submodule (ip6: { options = { addr = mkOption { type = addr6; @@ -163,9 +165,11 @@ rec { } // { retiolum.default = "42:0::/32"; wiregrill.default = "42:1::/32"; - }.${config._module.args.name} or {}); + }.${config._module.args.name} or { + default = "${ip6.config.addr}/128"; + }); }; - }); + })); default = null; }; ssh = mkOption { |