Started to define shared network config.

This commit is contained in:
Niten 2021-02-27 13:05:58 -06:00
parent 1486aaefee
commit 1351bc2878
2 changed files with 140 additions and 8 deletions

View File

@ -19,7 +19,7 @@ let
site = mkOption {
type = types.str;
description = "Site at which the host is located.";
description = "Site at which the host is located.";
};
local-networks = mkOption {
@ -31,8 +31,7 @@ let
profile = mkOption {
# FIXME: get this list from profiles directly
type = with types;
listof (enum "desktop" "laptop" "server");
type = with types; listof (enum "desktop" "laptop" "server");
description =
"The profile to be applied to the host, determining what software is included.";
};
@ -58,8 +57,8 @@ let
description = mkOption {
type = types.str;
description = "Description of this host.";
default = "Another Fudo Host.";
description = "Description of this host.";
default = "Another Fudo Host.";
};
local-admins = mkOption {
@ -71,13 +70,27 @@ let
local-groups = mkOption {
type = with types; listOf str;
description = "List of groups which should exist on this host.";
default = [ ];
description = "List of groups which should exist on this host.";
default = [ ];
};
hardware-config = mkOption {
type = types.str;
description = "Path to the hardware configuration for this host.";
description = "Path to the hardware configuration for this host.";
};
ssh-fingerprints = mkOption {
type = with types; listOf str;
description = ''
A list of DNS SSHFP records for this host.
'';
default = [ ];
};
rp = mkOption {
type = with types; nullOr str;
description = "Responsible person.";
default = null;
};
enable-gui = mkEnableOption "Install desktop GUI software.";

View File

@ -0,0 +1,119 @@
{ lib, ... }:
with lib;
let
srvRecordOpts = { service, ... }: {
options = with types; {
service = {
type = str;
description = "Service name of SRV record.";
};
priority = mkOption {
type = int;
description = "Priority to give to this record.";
default = 0;
};
port = mkOption {
type = port;
description = "Port for service on this host.";
example = 88;
};
host = mkOption {
type = str;
description = "Host providing service.";
example = "my-host.my-domain.com";
};
};
};
hostOpts = { hostname, ... }: {
options = with types; {
hostname = mkOption {
type = str;
description =
"Hostname (which may map to a host in config.fudo.hosts).";
default = hostname;
};
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 = with types; nullOr types.str;
description =
"The MAC address of a given host, if desired for IP reservation.";
default = null;
};
};
};
in {
options = with types; {
hosts = {
type = attrsOf networkHostOpts;
description = "Hosts on the local network, with relevant settings.";
default = { };
};
srv-records = {
type = attrsOf (attrsOf (listOf (submodule protocolSrvRecords)));
description = "SRV records for the network.";
default = {
tcp = {
kerberos = {
port = 88;
host = "krb-host.my-domain.com";
};
};
};
};
aliases = mkOption {
type = loaOf str;
default = { };
description =
"A mapping of host-alias -> hostnames to add to the domain record.";
example = {
mail = "my-mail-host";
music = "musicall-host.other-domain.com.";
};
};
verbatim-dns-records = mkOption {
type = listOf str;
description = "Records to be inserted verbatim into the DNS zone.";
example = [ "some-host IN CNAME base-host" ];
default = [ ];
};
dmarc-report-address = mkOption {
type = nullOr str;
description = "The email to use to recieve DMARC reports, if any.";
example = "admin-user@domain.com";
default = null;
};
default-host = mkOption {
type = nullOr str;
description =
"IP of the host which will act as the default server for this domain, if any.";
default = null;
};
};
}