lib.types.net.ip*: add net-independent defaults

This commit is contained in:
tv 2022-11-23 17:08:55 +01:00
parent a278a6503b
commit fe2262d706
1 changed files with 10 additions and 6 deletions

View File

@ -136,7 +136,7 @@ rec {
default = null; default = null;
}; };
ip4 = mkOption { ip4 = mkOption {
type = nullOr (submodule { type = nullOr (submodule (ip4: {
options = { options = {
addr = mkOption { addr = mkOption {
type = addr4; type = addr4;
@ -146,13 +146,15 @@ rec {
} // { } // {
retiolum.default = "10.243.0.0/16"; retiolum.default = "10.243.0.0/16";
wiregrill.default = "10.244.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; default = null;
}; };
ip6 = mkOption { ip6 = mkOption {
type = nullOr (submodule { type = nullOr (submodule (ip6: {
options = { options = {
addr = mkOption { addr = mkOption {
type = addr6; type = addr6;
@ -163,9 +165,11 @@ rec {
} // { } // {
retiolum.default = "42:0::/32"; retiolum.default = "42:0::/32";
wiregrill.default = "42:1::/32"; wiregrill.default = "42:1::/32";
}.${config._module.args.name} or {}); }.${config._module.args.name} or {
default = "${ip6.config.addr}/128";
});
}; };
}); }));
default = null; default = null;
}; };
ssh = mkOption { ssh = mkOption {