network options working for basic functionality
This commit is contained in:
parent
e4cdc2cae5
commit
392375b046
9 changed files with 348 additions and 221 deletions
156
nixos/network/options.nix
Normal file
156
nixos/network/options.nix
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
{ 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;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
};
|
||||
|
||||
lans = mkOption {
|
||||
type = types.attrsOf (types.submodule {
|
||||
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.";
|
||||
};
|
||||
|
||||
dhcp.endAddress = mkOption {
|
||||
type = types.nullOr (types.strMatching regex.ipv4);
|
||||
description = "Ending IP Address for DHCP clients.";
|
||||
};
|
||||
|
||||
dns.upstream = 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.";
|
||||
};
|
||||
|
||||
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";
|
||||
# };
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue