From 1ddbd3b8b6e3fc68dadda62cbe09c533a1e5d1fa Mon Sep 17 00:00:00 2001 From: Katharina Heidenreich Date: Sun, 22 Mar 2026 17:38:59 +0100 Subject: [PATCH] feat: rework network config --- config/endpoints.nix | 28 +++++++++++++++++++++++ config/network.nix | 54 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 config/endpoints.nix create mode 100644 config/network.nix diff --git a/config/endpoints.nix b/config/endpoints.nix new file mode 100644 index 0000000..7f9767f --- /dev/null +++ b/config/endpoints.nix @@ -0,0 +1,28 @@ +let + lib = import ; + 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; + }; + } + ] +} \ No newline at end of file diff --git a/config/network.nix b/config/network.nix new file mode 100644 index 0000000..c5915be --- /dev/null +++ b/config/network.nix @@ -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"; +} \ No newline at end of file