nixos/hosts/architect/headscale.nix
Giulio De Pasquale b644b9d684 headscale: init
2023-05-06 15:04:25 +02:00

62 lines
1.6 KiB
Nix

{ config, pkgs, ... }:
let
domain = "vipienne.giugl.io";
network = import ./network.nix;
in
{
architect.firewall = {
openTCP = [ config.services.headscale.port ];
};
networking.extraHosts = ''
${network.architect-lan} ${domain}
${network.architect-wg} ${domain}
${network.architect-ts} ${domain}
'';
environment.systemPackages = [ pkgs.unstablePkgs.headscale ];
services = {
headscale = {
enable = true;
package = pkgs.unstablePkgs.headscale;
port = 1194;
address = "0.0.0.0";
serverUrl = "https://${domain}";
logLevel = "debug";
settings = {
dns_config = {
magic_dns = true;
# domains = [ "giugl.io" "runas.rocks" ];
# base_domain = "giugl.io";
override_local_dns = true;
nameservers = "10.4.0.2";
};
logtail.enabled = false;
ip_prefixes = [ "10.4.0.0/24" ];
# The Noise private key is used to encrypt the
# traffic between headscale and Tailscale clients when
# using the new Noise-based protocol. It must be different
# from the legacy private key.
noise.private_key_path = "/var/lib/headscale/noise_private.key";
};
};
# ssl.key = "${config.security.acme.certs.${domain}.directory}/key.pem";
# ssl.cert =
# "${config.security.acme.certs.${domain}.directory}/fullchain.pem";
nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass =
"http://127.0.0.1:${toString config.services.headscale.port}";
proxyWebsockets = true;
};
};
};
}