fix(headscale): build custom config to update it to alpha
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-04-01 01:50:30 -04:00
parent c5898a9a64
commit aa2f5b2906

View file

@ -6,71 +6,79 @@
... ...
}: let }: let
inherit (builtins) readFile; inherit (builtins) readFile;
inherit (lib) mkAfter mkOption; inherit (lib) mkAfter mkForce;
inherit (pkgs.writers) writeYAML;
inherit (config.vars) mainUser hostName; inherit (config.vars) mainUser hostName;
headscale-flake = headscale.packages.${pkgs.system}.headscale; headscale-flake = headscale.packages.${pkgs.system}.headscale;
clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip; clusterIP = config.services.pcsd.virtualIps.caddy-vip.ip;
in { in {
# FIXME: wait for nixpkgs to reach this : https://github.com/juanfont/headscale/commit/94b30abf56ae09d82a1541bbc3d19557914f9b27 environment.systemPackages = [headscale-flake];
options.services.headscale.settings.db_type = mkOption { users.users.${mainUser}.extraGroups = ["headscale"];
type = lib.types.enum ["sqlite" "postgres"];
};
config = { home-manager.users.${mainUser}
environment.systemPackages = [headscale-flake];
users.users.${mainUser}.extraGroups = ["headscale"];
home-manager.users.${mainUser}
.programs.bash.bashrcExtra = mkAfter (readFile ./completion.bash); .programs.bash.bashrcExtra = mkAfter (readFile ./completion.bash);
services.headscale = { services.headscale = {
enable = true; enable = true;
package = headscale-flake; package = headscale-flake;
};
address = clusterIP; environment.etc."headscale/config.yaml".source = mkForce (
port = 8085; writeYAML "headscale.yaml" {
server_url = "https://headscale.nelim.org";
listen_addr = "${clusterIP}:8085";
prefixes = {
v4 = "100.64.0.0/10";
v6 = "fd7a:115c:a1e0::/48";
};
metrics_listen_addr = "127.0.0.1:9090";
grpc_listen_addr = "0.0.0.0:50443";
grpc_allow_insecure = false;
disable_check_updates = true;
ephemeral_node_inactivity_timeout = "30m";
unix_socket = "/run/headscale/headscale.sock";
unix_socket_permission = "0770";
settings = { database = {
server_url = "https://headscale.nelim.org"; type = "sqlite";
ip_prefixes = ["100.64.0.0/10"]; sqlite.path = "/var/lib/headscale/db.sqlite";
metrics_listen_addr = "127.0.0.1:9090"; };
grpc_listen_addr = "0.0.0.0:50443";
grpc_allow_insecure = false;
disable_check_updates = true;
unix_socket_permission = "0770";
db_type = "sqlite"; private_key_path = "/var/lib/headscale/private.key";
db_path = "/var/lib/headscale/db.sqlite"; noise.private_key_path = "/var/lib/headscale/noise_private.key";
private_key_path = "/var/lib/headscale/private.key";
noise.private_key_path = "/var/lib/headscale/noise_private.key";
dns_config = let dns_config = let
caddyIp = caddyIp =
if hostName == "thingone" if hostName == "thingone"
then "100.64.0.8" then "100.64.0.8"
else "100.64.0.9"; else "100.64.0.9";
in { in {
magic_dns = false; magic_dns = false;
override_local_dns = true; override_local_dns = true;
nameservers = [caddyIp]; nameservers = [caddyIp];
}; };
derp = { log = {
urls = []; format = "text";
level = "info";
};
server = { derp = {
enabled = true; auto_update_enable = true;
stun_listen_addr = "${clusterIP}:3479"; update_frequency = "24h";
private_key_path = "/var/lib/headscale/derp_server_private.key";
region_id = 995; server = {
region_code = "mon"; enabled = true;
region_name = "montreal"; stun_listen_addr = "${clusterIP}:3479";
}; private_key_path = "/var/lib/headscale/derp_server_private.key";
region_id = 995;
region_code = "mon";
region_name = "montreal";
}; };
}; };
}; }
}; );
} }