summaryrefslogtreecommitdiff
path: root/modules/nixos/headscale.nix
blob: a4c9308dd3a79ea32373886a85e0dfb672aa7696 (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
36
37
38
39
40
41
{config, pkgs, ...}:
let 
  domain = "myrmexia.xyz";
  subDomain = "bosco.${domain}";
in {
  services = {
    headscale = {
      enable = true;
      address = "0.0.0.0";
      port = 8080;
      settings = { 
        logtail.enabled = false; 
        serverUrl = "https://${subDomain}";
        dns_config.base_domain = "${domain}";
      };
    };

    nginx.virtualHosts.${subDomain} = {
      forceSSL = true;
      enableACME = true;
      locations."/" = {
        proxyPass =
          "http://localhost:${toString config.services.headscale.port}";
        proxyWebsockets = true;
      };
    };
  };

  environment.systemPackages = [ config.services.headscale.package ];

  security.acme = {
    acceptTerms = true;
    email = "devin.finlinson@pm.me";
  };

  networking.firewall.allowedTCPPorts = [
    80
    443
  ];
}