186 lines
No EOL
4.9 KiB
Nix
186 lines
No EOL
4.9 KiB
Nix
{ config, pkgs, lib, vmixLib, ... }:
|
|
with lib;
|
|
with vmixLib.network;
|
|
{
|
|
options = {
|
|
bridges.macvlans = mkOption {
|
|
type = types.attrsOf (types.submodule {
|
|
options = {
|
|
uplink.iface = mkOption {
|
|
type = types.str;
|
|
};
|
|
|
|
uplink.namespace = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
};
|
|
|
|
namespace = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
};
|
|
|
|
ipv4.static.address = mkOption {
|
|
type = types.nullOr (types.strMatching regex.ipOrCidr4);
|
|
default = null;
|
|
};
|
|
|
|
ipv4.static.gateway = mkOption {
|
|
type = types.nullOr (types.strMatching regex.ipv4);
|
|
default = null;
|
|
};
|
|
|
|
ipv4.dhcp.client = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
|
|
ipv4.dhcp.gateway = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
});
|
|
};
|
|
|
|
bridges.macvtaps = mkOption {
|
|
type = types.attrsOf (types.submodule {
|
|
options = {
|
|
uplink.iface = mkOption {
|
|
type = types.str;
|
|
};
|
|
|
|
uplink.namespace = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
};
|
|
|
|
many = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
};
|
|
});
|
|
};
|
|
|
|
wan = {
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
dns.nameservers = mkOption {
|
|
type = types.listOf (types.strMatching regex.ipv4);
|
|
default = [];
|
|
description = "List of IP Addresses of DNS servers to use as upstream DNS servers in the DHCP/DNS server. If left empty, it will use host's DNS servers";
|
|
};
|
|
|
|
dns.useHostResolvConf = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Whether to use host's /etc/resolv.conf for upstream DNS queries.";
|
|
};
|
|
|
|
host.wan.enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
host.wan.masquerade = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
host.lan.enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
host.lan.masquerade = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
host.self.enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
host.self.dns.addNSLansResolver = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
|
|
host.self.addNSLansRoutes = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
};
|
|
};
|
|
|
|
lans = mkOption {
|
|
type = types.attrsOf (types.submodule {
|
|
options.domain = mkOption {
|
|
type = types.nullOr types.str;
|
|
default = null;
|
|
description = "Domain name for the hosts of this lan.";
|
|
};
|
|
|
|
options.ipv4 = {
|
|
range = mkOption {
|
|
type = types.strMatching regex.cidr4;
|
|
description = "IPv4 Range in x.x.x.x/y format to be assigned to the network.";
|
|
};
|
|
|
|
address = mkOption {
|
|
type = types.nullOr (types.strMatching regex.ipv4);
|
|
default = null;
|
|
description = "IPv4 address to attach to the bridge interface of this Lan.";
|
|
};
|
|
|
|
dhcp.enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Whether to start a DHCP server within this network.";
|
|
};
|
|
|
|
dhcp.startAddress = mkOption {
|
|
type = types.nullOr (types.strMatching regex.ipv4);
|
|
description = "Starting IP Address for DHCP clients.";
|
|
default = null;
|
|
};
|
|
|
|
dhcp.endAddress = mkOption {
|
|
type = types.nullOr (types.strMatching regex.ipv4);
|
|
description = "Ending IP Address for DHCP clients.";
|
|
default = null;
|
|
};
|
|
|
|
dhcp.dns.resolver.enable = mkOption {
|
|
type = types.bool;
|
|
default = true;
|
|
description = "Add dnsmasq's built in resolver to lan clients DHCP responses";
|
|
};
|
|
|
|
dhcp.dns.nameservers = mkOption {
|
|
type = types.listOf (types.strMatching regex.ipv4);
|
|
default = [];
|
|
description = "List of IP Addresses of DNS servers to use as upstream DNS servers in the DHCP/DNS server. If left empty, it will use host's DNS servers";
|
|
};
|
|
|
|
dhcp.dns.zonefiles = mkOption {
|
|
default = null;
|
|
description = "Additional zonefiles to add for the DNS server";
|
|
};
|
|
};
|
|
});
|
|
};
|
|
|
|
# routes.internal.add = mkOption {
|
|
# description = "Additional routes to add on the internal network";
|
|
# };
|
|
|
|
# routes.host.add = mkOption {
|
|
# description = "Addtional routes to add on the host's network namespace";
|
|
# };
|
|
};
|
|
} |