127 lines
3.0 KiB
Nix
127 lines
3.0 KiB
Nix
{
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
options.homelab.networking = {
|
|
user = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "river";
|
|
description = "The user to run tailscale's services as.";
|
|
};
|
|
|
|
# core
|
|
core = {
|
|
firewall = {
|
|
allowPing = lib.mkEnableOption "Enable ICMP Pinging" {
|
|
enable = true;
|
|
default = true;
|
|
};
|
|
|
|
ports = {
|
|
tcp = lib.mkOption {
|
|
type = with lib.types; listOf number;
|
|
default = [
|
|
22
|
|
80
|
|
];
|
|
};
|
|
udp = lib.mkOption {
|
|
type = with lib.types; listOf number;
|
|
default = [ 53 ];
|
|
};
|
|
};
|
|
};
|
|
|
|
extraHosts = lib.mkOption {
|
|
type =
|
|
with lib.types;
|
|
listOf (
|
|
submodule (
|
|
{ ... }: {
|
|
options = {
|
|
ip_address = lib.mkOption {
|
|
type = str;
|
|
};
|
|
|
|
hostname = lib.mkOption {
|
|
type = str;
|
|
};
|
|
};
|
|
}
|
|
)
|
|
);
|
|
|
|
default = [ ];
|
|
description = "Additional hosts to add.";
|
|
};
|
|
|
|
nameservers = lib.mkOption {
|
|
type = with lib.types; listOf str;
|
|
|
|
default = [
|
|
"192.168.1.193"
|
|
"1.1.1.1"
|
|
"1.0.0.1"
|
|
];
|
|
description = "DNS Resolvers for System";
|
|
};
|
|
};
|
|
|
|
# wireguard
|
|
wireguard = {
|
|
enable = lib.mkEnableOption "Wireguard support";
|
|
|
|
interfaces = lib.mkOption {
|
|
type = lib.types.attrsOf (
|
|
lib.types.submodule {
|
|
options = {
|
|
enable = lib.mkEnableOption "Enable this WG interface";
|
|
|
|
address = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
};
|
|
|
|
privateKeyFile = lib.mkOption {
|
|
type = lib.types.str;
|
|
};
|
|
|
|
peers = lib.mkOption {
|
|
type = lib.types.listOf (
|
|
lib.types.submodule {
|
|
options = {
|
|
publicKey = lib.mkOption { type = lib.types.str; };
|
|
allowedIPs = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
};
|
|
endpoint = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "";
|
|
};
|
|
persistentKeepalive = lib.mkOption {
|
|
type = lib.types.nullOr lib.types.int;
|
|
default = null;
|
|
};
|
|
};
|
|
}
|
|
);
|
|
default = [ ];
|
|
};
|
|
};
|
|
}
|
|
);
|
|
};
|
|
};
|
|
|
|
# tailscale
|
|
tailscale = {
|
|
enable = lib.mkEnableOption "Enable Tailscale Mesh VPN" {
|
|
enable = true;
|
|
default = false;
|
|
};
|
|
};
|
|
};
|
|
}
|