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 | 4d78208a98efa9612e77decc6101d17df0e55de3 (patch) | |
| tree | 9407e5253adb9988f5b9dba7e643f72962b8d0f0 /lib | |
| parent | 16d2c2e23d2b5d5f75b820285aa038a4d15342cc (diff) | |
lib.types.net.ip*: add net-independent defaults
Diffstat (limited to 'lib')
| -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 0e0e093..67a0c6f 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 { | 
