diff --git a/configMaker.nix b/configMaker.nix index 4ab6644..601ac4a 100644 --- a/configMaker.nix +++ b/configMaker.nix @@ -29,7 +29,7 @@ let module_inst = { "me0" = { # mgmt enable = true; - management = true; + management = "192.168.42.6/24"; }; }; vlans = { diff --git a/moduleMaker.nix b/moduleMaker.nix index 538a311..9227414 100644 --- a/moduleMaker.nix +++ b/moduleMaker.nix @@ -29,8 +29,9 @@ in with lib; { default = false; }; management = mkOption { - type = types.bool; - default = false; + # FIXME : support ipv4 and ipv6, either static or dhcp (with the coffee) + type = types.nullOr types.str; + default = null; }; }; in builtins.listToAttrs (map (name: { inherit name; value = template name; }) interfaces); @@ -46,7 +47,12 @@ in with lib; { intf_xmlGen = name: let disable_flag = if !cfg.interfaces.${name}.enable then "" else ""; # FIXME : need to enforce address in reality - mgmt_fam = if cfg.interfaces.${name}.management then "" else ""; + mgmt_fam = if !builtins.isNull cfg.interfaces.${name}.management then '' + +
+ ${cfg.interfaces.${name}.management} +
+
'' else ""; members = map (vlan: "${builtins.toString vlan}") cfg.interfaces.${name}.vlans; eth_switch = if builtins.isNull cfg.interfaces.${name}.interface-mode then "" else '' @@ -68,7 +74,7 @@ in with lib; { interface_xmls = map intf_xmlGen interfaces; vlan_trust_table = let vlan_map = inter: vlan: - if builtins.isString vlan then + if builtins.isString vlan && cfg.interfaces.${inter}.enable then if cfg.interfaces.${inter}.dhcp_trusted then { ${vlan}.trust = inter; } else