Ah fuckit, don't put it in types at all

This commit is contained in:
niten 2023-11-17 10:06:04 -08:00
parent dca7d8c9ef
commit a0493a2eef
1 changed files with 44 additions and 46 deletions

90
lib.nix
View File

@ -71,9 +71,49 @@ in {
getSiteGatewayV4 getHostGatewayV4 getSiteGatewayV6 getHostGatewayV6
getSiteV4PrefixLength getSiteV6PrefixLength;
types = lib.types // {
fudo = with lib.types; rec {
networkHost = {
fudo-types = 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, ... }: {
hostname = mkOption {
type = str;
description = "Hostname";
@ -111,48 +151,6 @@ in {
default = [ ];
};
};
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);
};
in attrsOf (submodule networkHostOpt);
};
}