C'mon now

This commit is contained in:
niten 2023-11-17 11:05:58 -08:00
parent a0493a2eef
commit 2ff1389b1c
1 changed files with 34 additions and 32 deletions

66
lib.nix
View File

@ -71,8 +71,8 @@ in {
getSiteGatewayV4 getHostGatewayV4 getSiteGatewayV6 getHostGatewayV6 getSiteGatewayV4 getHostGatewayV4 getSiteGatewayV6 getHostGatewayV6
getSiteV4PrefixLength getSiteV6PrefixLength; getSiteV4PrefixLength getSiteV6PrefixLength;
fudo-types = with lib.types; rec { fudo-types = with lib.types; {
networkHost = { networkHost.options = {
hostname = mkOption { hostname = mkOption {
type = str; type = str;
description = "Hostname"; description = "Hostname";
@ -114,41 +114,43 @@ in {
networkHosts = let networkHosts = let
# This is necessary because of the default 'name'...sigh. # This is necessary because of the default 'name'...sigh.
networkHostOpt = { name, ... }: { networkHostOpt = { name, ... }: {
hostname = mkOption { options = {
type = str; hostname = mkOption {
description = "Hostname"; type = str;
default = name; description = "Hostname";
}; default = name;
};
ipv4-address = mkOption { ipv4-address = mkOption {
type = nullOr str; type = nullOr str;
description = "The V4 IP of a given host, if any."; description = "The V4 IP of a given host, if any.";
default = null; default = null;
}; };
ipv6-address = mkOption { ipv6-address = mkOption {
type = nullOr str; type = nullOr str;
description = "The V6 IP of a given host, if any."; description = "The V6 IP of a given host, if any.";
default = null; default = null;
}; };
mac-address = mkOption { mac-address = mkOption {
type = nullOr str; type = nullOr str;
description = description =
"The MAC address of a given host, if desired for IP reservation."; "The MAC address of a given host, if desired for IP reservation.";
default = null; default = null;
}; };
description = mkOption { description = mkOption {
type = nullOr str; type = nullOr str;
description = "Description of the host."; description = "Description of the host.";
default = null; default = null;
}; };
sshfp-records = mkOption { sshfp-records = mkOption {
type = listOf str; type = listOf str;
description = "List of SSHFP records for this host."; description = "List of SSHFP records for this host.";
default = [ ]; default = [ ];
};
}; };
}; };
in attrsOf (submodule networkHostOpt); in attrsOf (submodule networkHostOpt);