nixcfg/systems/x86_64-linux/attic/default.nix
Harald Hoyer 12c25bcde8 refactor(attic): move headscale from mx to attic
Headscale is moving off the mx mailserver onto the attic cache host.
The new public URL is https://headscale.hoyer.world.

- Switch from useACMEHost = "hoyer.xyz" (mx wildcard DNS-01) to
  enableACME = true, since attic only has HTTP-01 configured.
- Move headscale port to 8081 to avoid clashing with atticd on 8080.
- Drop the 192.168.178.254 LAN nameserver from dns.nameservers.global,
  which isn't reachable from the Hetzner instance.

Operational steps still required on attic:
- Provision /var/lib/headscale/client_secret
- Migrate the headscale state DB from mx
- Point headscale.hoyer.world DNS at attic
- Update the Nextcloud OIDC client's redirect URI
2026-05-13 08:42:46 +02:00

92 lines
2 KiB
Nix

{
lib,
...
}:
{
imports = [
./hardware-configuration.nix
./atticd.nix
./headscale.nix
];
metacfg = {
base.enable = true;
nix.enable = true;
};
system.autoUpgrade = {
enable = true;
operation = "switch";
allowReboot = true;
};
virtualisation = {
docker.enable = true;
podman.dockerCompat = false;
libvirtd.enable = false;
};
# Legacy BIOS boot (Hetzner cloud instance)
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.loader.efi.canTouchEfiVariables = lib.mkForce false;
boot.loader.grub.enable = true;
security.sudo.wheelNeedsPassword = false;
security.tpm2.enable = false;
security.tpm2.abrmd.enable = false;
networking.wireless.enable = false;
networking.useDHCP = false;
networking.useNetworkd = true;
systemd.network.networks."30-wan" = {
matchConfig.Name = "enp1s0";
networkConfig.DHCP = "ipv4";
address = [ "2a01:4f9:c014:619::1/64" ];
routes = [ { Gateway = "fe80::1"; } ];
};
networking.firewall.allowedTCPPorts = [
80
443
];
networking.firewall.allowPing = true;
security.acme = {
acceptTerms = true;
defaults.email = "harald@hoyer.xyz";
};
services.nginx = {
enable = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
appendHttpConfig = ''
proxy_cache_path /var/cache/nginx/attic
levels=1:2
keys_zone=attic:10m
max_size=10g
inactive=30d
use_temp_path=off;
'';
virtualHosts."attic.teepot.org" = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://[::1]:8080";
proxyWebsockets = true;
extraConfig = ''
client_max_body_size 0;
proxy_cache attic;
proxy_cache_valid 200 30d;
proxy_cache_use_stale error timeout updating;
proxy_cache_methods GET HEAD;
proxy_cache_lock on;
'';
};
};
};
powerManagement.cpuFreqGovernor = "ondemand";
system.stateVersion = "25.11";
}