From 868e6ca2960f1e37321c6bee9108e9abec0dbf6b Mon Sep 17 00:00:00 2001 From: niten Date: Thu, 16 Nov 2023 10:02:42 -0800 Subject: [PATCH] Add networkHost(s) types --- lib.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/lib.nix b/lib.nix index 6196a81..9801c35 100644 --- a/lib.nix +++ b/lib.nix @@ -70,4 +70,47 @@ in { getHostIpv6 getHostIps getDomainPostgresqlServer getSiteHosts getDomainHosts getSiteGatewayV4 getHostGatewayV4 getSiteGatewayV6 getHostGatewayV6 getSiteV4PrefixLength getSiteV6PrefixLength; + + fudo.types = with lib.types; rec { + networkHost = { 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 = [ ]; + }; + }; + + networkHosts = attrsOf (submodule networkHost); + }; }