nix/moduler/services/headscale/default.nix
2025-09-13 22:02:42 +02:00

46 lines
986 B
Nix

{
lib,
config,
...
}:
with lib;
{
options = {
headscale = {
enable = mkEnableOption "enables headscale";
domain = lib.mkOption {
type = lib.types.str;
default = "headscale.wastring.com";
description = "The domain that headscale is served on.";
};
};
};
config = mkMerge [
(mkIf config.headscale.enable {
services = {
headscale = {
enable = true;
address = "0.0.0.0";
port = 8080;
server_url = "https://${domain}";
dns = {
baseDomain = "example.com";
};
settings = {
logtail.enabled = false;
};
};
nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://localhost:${toString config.services.headscale.port}";
proxyWebsockets = true;
};
};
};
})
];
}