summaryrefslogtreecommitdiff
path: root/modules/nixos/headscale.nix
blob: 00ddf5d88de8652dcc815373d8ecff4a62442f8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{config, ...}:
let 
  domain = "myrmexia.xyz";
  subDomain = "bosco.${domain}";
  email = "devin.finlinson@pm.me";
in {
  services = {
    headscale = {
      enable = true;
      address = "0.0.0.0";
      port = 8080;
      settings = { 
        logtail.enabled = false; 
        serverUrl = "https://${subDomain}";
        dns.base_domain = "${domain}";
        ip_prefixes = [
          "100.64.0.0/10"
          "fd7a:115c:a1e0::/48"
        ];
      };
    };

    caddy = {
      enable = true;
      email = "${email}";
      virtualHosts.${subDomain}.extraConfig = ''
        reverse_proxy http://localhost:${toString config.services.headscale.port}
      '';
    };
  };

  networking.firewall.allowedTCPPorts = [ 80 443 ];
  environment.systemPackages = [ config.services.headscale.package ];
}