From e7146bc012151ac5a0762e425305de29ca27ad62 Mon Sep 17 00:00:00 2001 From: niten Date: Fri, 17 Nov 2023 09:54:02 -0800 Subject: [PATCH] Don't overwrite types? --- lib.nix | 90 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/lib.nix b/lib.nix index 2b06c64..b27941f 100644 --- a/lib.nix +++ b/lib.nix @@ -71,49 +71,9 @@ in { getSiteGatewayV4 getHostGatewayV4 getSiteGatewayV6 getHostGatewayV6 getSiteV4PrefixLength getSiteV6PrefixLength; - types.fudo = with lib.types; rec { - networkHost = { - hostname = mkOption { - type = str; - description = "Hostname"; - default = name; - }; - - ipv4-address = mkOption { - type = nullOr str; - description = "The V4 IP of a given host, if any."; - default = null; - }; - - ipv6-address = mkOption { - type = nullOr str; - description = "The V6 IP of a given host, if any."; - default = null; - }; - - mac-address = mkOption { - type = nullOr str; - description = - "The MAC address of a given host, if desired for IP reservation."; - default = null; - }; - - description = mkOption { - type = nullOr str; - description = "Description of the host."; - default = null; - }; - - sshfp-records = mkOption { - type = listOf str; - description = "List of SSHFP records for this host."; - default = [ ]; - }; - }; - - networkHosts = let - # This is necessary because of the default 'name'...sigh. - networkHostOpt = { name, ... }: { + types = lib.type // { + fudo = with lib.types; rec { + networkHost = { hostname = mkOption { type = str; description = "Hostname"; @@ -151,6 +111,48 @@ in { default = [ ]; }; }; - in attrsOf (submodule networkHostOpt); + + networkHosts = let + # This is necessary because of the default 'name'...sigh. + networkHostOpt = { name, ... }: { + hostname = mkOption { + type = str; + description = "Hostname"; + default = name; + }; + + ipv4-address = mkOption { + type = nullOr str; + description = "The V4 IP of a given host, if any."; + default = null; + }; + + ipv6-address = mkOption { + type = nullOr str; + description = "The V6 IP of a given host, if any."; + default = null; + }; + + mac-address = mkOption { + type = nullOr str; + description = + "The MAC address of a given host, if desired for IP reservation."; + default = null; + }; + + description = mkOption { + type = nullOr str; + description = "Description of the host."; + default = null; + }; + + sshfp-records = mkOption { + type = listOf str; + description = "List of SSHFP records for this host."; + default = [ ]; + }; + }; + in attrsOf (submodule networkHostOpt); + }; }; }