feat: rework network config

This commit is contained in:
Katharina Heidenreich 2026-03-22 17:38:59 +01:00
parent 43d47ec3b6
commit 1ddbd3b8b6
2 changed files with 82 additions and 0 deletions

28
config/endpoints.nix Normal file
View file

@ -0,0 +1,28 @@
let
lib = import <nixpkgs/lib>;
net = import ./network.nix;
in
rec {
[
{
type = "web";
domain = "${net.devices.remote_proxy.domain}";
endpoint = "/";
force_ssl = true;
port = 443;
content = web.home;
}
{
type = "proxy";
domain = "torrent.${net.local_domain}";
endpoint = "/";
forceSsl = false;
port = 80;
content = {
type = "service";
url = "localhost";
port = services.torrent.port;
};
}
]
}

54
config/network.nix Normal file
View file

@ -0,0 +1,54 @@
rec {
network = {
subnet = "192.168.2.0/24";
subnet_base = "192.168.2.0";
gateway = ips.router;
cidr = 24;
};
devices = {
"pi" = {
type = "local";
ip = "192.168.2.100";
};
"desktop" = {
type = "local";
ip = "192.168.2.101";
reservation = {
hw_address = "30:9c:23:81:91:ea";
hostname = "desktop";
};
};
"router" = {
type = "local";
ip = "192.168.2.1";
};
"remote_proxy" = {
type = "auto_ssh";
ip = "193.31.24.99";
domain = "nudelerde.de";
auto_ssh = {
sshPort = 22;
sshUser = "root";
key = secret.remote_proxy_key;
known_hosts = secret.remote_proxy_known_hosts;
forwards = [];
};
};
};
dhcp = {
pool_start = "192.168.2.50";
pool_end = "192.168.2.90";
default_lease = 3600;
max_lease = 86400;
};
fallback_dns_servers = [
"1.1.1.1"
"8.8.8.8"
];
local_domain = "home";
extern_domain = "nudelerde.de";
}