blob: fe7e12b8218af6c1e61d8cc6312ae18dd895fd9a (
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
|
{ config, lib, pkgs, ... }:
let
cfg = config.headscale;
in
{
options.headscale = {
port = lib.mkOption {
type = lib.types.int;
};
domain = lib.mkOption {
type = lib.types.str;
};
};
config = {
services = {
headscale = {
enable = true;
port = cfg.port;
# TODO: make dataDir configurable and set it to /srv/
settings = {
server_url = "https://${cfg.domain}";
dns = { base_domain = "tailnet"; };
};
};
nginx.virtualHosts.${cfg.domain} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:${toString cfg.port}";
proxyWebsockets = true;
};
};
};
};
}
|