summaryrefslogtreecommitdiff
path: root/nixos/hosts/tente/headscale.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/hosts/tente/headscale.nix')
-rw-r--r--nixos/hosts/tente/headscale.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/nixos/hosts/tente/headscale.nix b/nixos/hosts/tente/headscale.nix
new file mode 100644
index 0000000..6faea12
--- /dev/null
+++ b/nixos/hosts/tente/headscale.nix
@@ -0,0 +1,35 @@
+{ config, lib, pkgs, ... }:
+
+let
+ cfg = config.headscale;
+in
+{
+ options.headscale = {
+ domain = lib.mkOption {
+ type = lib.types.str;
+ };
+ };
+
+ config = {
+ services = {
+ headscale = {
+ enable = true;
+ port = 8080;
+ # 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 config.services.headscale.port}";
+ proxyWebsockets = true;
+ };
+ };
+ };
+ };
+}