blob: f951043af1eede93c509c1169330286ab2c63c27 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
{config, ...}:
let
domain = "myrmexia.xyz";
subDomain = "tailscale.${domain}";
ipv4 = "100.64.0.";
ipv6 = "fd7a:115c:a1e0::";
in {
services = {
headscale = {
enable = true;
address = "0.0.0.0";
port = 8080;
settings = {
logtail.enabled = false;
server_url = "https://headscale.${domain}:8081";
dns = {
base_domain = "${subDomain}";
nameservers.global = [
"1.1.1.1"
"9.9.9.9"
"2606:4700:4700::1111"
"2606:4700:4700::1001"
];
extra_records = [
{
name = "git.${domain}";
type = "A";
value = "${ipv4}3";
}
{
name = "git.${domain}";
type = "AAAA";
value = "${ipv6}3";
}
];
};
prefixes = {
v4 = "${ipv4}0/10";
v6 = "${ipv6}/48";
};
};
};
caddy = {
enable = true;
virtualHosts.${subDomain}.extraConfig = ''
reverse_proxy localhost:${toString config.services.headscale.port}
'';
virtualHosts."headscale.${domain}".extraConfig = ''
reverse_proxy localhost:8081
'';
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
environment.systemPackages = [ config.services.headscale.package ];
}
|