tailscale, headscale: init

This commit is contained in:
Katherina Walshe-Grey 2025-05-21 19:28:07 +01:00
parent b35fefbf98
commit a98fd9ba83
5 changed files with 67 additions and 0 deletions

View file

@ -4,6 +4,7 @@
./audiobookshelf.nix
./distributed-builds.nix
./forgejo.nix
./headscale.nix
./jellyfin.nix
./navidrome.nix
./owncast.nix

50
services/headscale.nix Normal file
View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkIf mkOption mkEnableOption types;
cfg = config.qenya.services.headscale;
in
{
options.qenya.services.headscale = {
enable = mkEnableOption "Headscale";
domain = mkOption {
type = types.str;
};
dataDir = mkOption {
type = types.str;
};
};
config = mkIf cfg.enable {
services.nginx = {
enable = true;
virtualHosts = {
${cfg.domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:32770/";
proxyWebsockets = true;
};
};
};
};
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.headscale = {
enable = true;
address = "0.0.0.0"; # required to disable built-in ACME client for some reason
port = 32770;
settings = {
server_url = "https://${cfg.domain}:443";
prefixes.allocation = "random";
dns.magic_dns = false;
# disable built-in ACME client
tls_cert_path = null;
tls_key_path = null;
};
};
};
}