{ config, lib, pkgs, inputs, ... }: with lib; let cfg = config.modules.services.headscale; fqdn = "headscale.vimium.net"; in { options.modules.services.headscale = { enable = mkOption { default = false; example = true; }; }; config = mkIf cfg.enable { environment.systemPackages = [ pkgs.headscale ]; services.headscale = { enable = true; port = 8080; settings = { ip_prefixes = [ "100.64.0.0/10" ]; server_url = "https://${fqdn}"; dns_config = { base_domain = "vimium.net"; extra_records = [ { name = "grafana.mesh.vimium.net"; type = "A"; value = "100.64.0.6"; } { name = "home.mesh.vimium.net"; type = "A"; value = "100.64.0.7"; } ]; }; logtail.enabled = false; }; }; services.nginx.virtualHosts = { "${fqdn}" = { forceSSL = true; enableACME = true; locations."/" = { proxyPass = "http://localhost:${toString config.services.headscale.port}"; proxyWebsockets = true; }; }; }; }; }