nixos-config/config/fudo/local-network.nix

97 lines
2.0 KiB
Nix

# UNFINISHED!
#
# The plan is to bootstrap a local network config: DNS, DHCP, etc.
{ lib, config, pkgs, ... }:
with lib;
let
hostOpts = { config, ... }: {
options = {
ipv6Address = mkOption {
type = types.str;
description = ''
The V6 IP of a given host, if any.
'';
};
ipv4Address = mkOption {
type = types.str;
description = ''
The V4 IP of a given host, if any.
'';
};
macAddress = mkOption {
type = types.str;
description = ''
The MAC address of a given host, if desired for IP reservation.
'';
};
};
};
localNameServerOpts = { config, ... }: {
options = {
ipv6Address = mkOption {
type = types.str;
description = ''
The V6 IP of this nameserver, if any.
'';
};
ipv4Address = mkOption {
type = types.str;
description = ''
The V4 IP of this nameserver, if any.
'';
};
ipv4ReverseDomain = mkOption {
type = types.str;
description = ''
The domain of the IPv4 address range for which this nameserver is responsible.
Eg: 0.10.in-addr.arpa
'';
};
};
};
in {
options = {
fudo.localNetwork.hosts = mkOption {
type = types.listOf (submodule hostOpts);
default = {};
description = ''
A map of hostname => { host_attributes }.
'';
};
fudo.localNetwork.domain = mkOption {
type = types.str;
description = ''
The domain to use for the local network.
'';
};
fudo.localNetwork.hostAliases = mkOption {
type = types.attrsOf types.str;
default = {};
description = ''
A mapping of hostAlias => hostName to use on the local network.
'';
};
fudo.localNetwork.localNameServer = mkOption {
type = (submodule localNameServerOpts);
description = ''
The master nameserver of the local network.
'';
};
};
}