summaryrefslogtreecommitdiffstats
path: root/krebs/4lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-04-08 03:53:34 +0200
committertv <tv@krebsco.de>2016-04-08 03:53:34 +0200
commit46e818ebbc5446b4215ad9524089d9b2dc91cbd3 (patch)
tree13d7021f55991559d17f3eb51e7ffb8957d093e5 /krebs/4lib
parent827f1790803bda906ed71c56138cfdbf108ee730 (diff)
retiolum: don't hardcode routing prefixes
Diffstat (limited to 'krebs/4lib')
-rw-r--r--krebs/4lib/types.nix48
1 files changed, 38 insertions, 10 deletions
diff --git a/krebs/4lib/types.nix b/krebs/4lib/types.nix
index 7255dc3e1..24b4e14b1 100644
--- a/krebs/4lib/types.nix
+++ b/krebs/4lib/types.nix
@@ -63,28 +63,56 @@ types // rec {
net = submodule ({ config, ... }: {
options = {
+ name = mkOption {
+ type = label;
+ default = config._module.args.name;
+ };
via = mkOption {
type = nullOr net;
default = null;
};
addrs = mkOption {
type = listOf addr;
- default = config.addrs4 ++ config.addrs6;
- # TODO only default addrs make sense
- };
- addrs4 = mkOption {
- type = listOf addr4;
- default = [];
- };
- addrs6 = mkOption {
- type = listOf addr6;
- default = [];
+ default =
+ optional (config.ip4 != null) config.ip4.addr ++
+ optional (config.ip6 != null) config.ip6.addr;
+ readOnly = true;
};
aliases = mkOption {
# TODO nonEmptyListOf hostname
type = listOf hostname;
default = [];
};
+ ip4 = mkOption {
+ type = nullOr (submodule {
+ options = {
+ addr = mkOption {
+ type = addr4;
+ };
+ prefix = mkOption ({
+ type = str; # TODO routing prefix (CIDR)
+ } // optionalAttrs (config.name == "retiolum") {
+ default = "10.243.0.0/16";
+ });
+ };
+ });
+ default = null;
+ };
+ ip6 = mkOption {
+ type = nullOr (submodule {
+ options = {
+ addr = mkOption {
+ type = addr6;
+ };
+ prefix = mkOption ({
+ type = str; # TODO routing prefix (CIDR)
+ } // optionalAttrs (config.name == "retiolum") {
+ default = "42::/16";
+ });
+ };
+ });
+ default = null;
+ };
ssh = mkOption {
type = submodule {
options = {