From df1214e7d2200b0a0f3dfce9d39d9e73e9b267d4 Mon Sep 17 00:00:00 2001 From: geemili Date: Wed, 10 Jan 2024 00:48:59 -0700 Subject: [PATCH] fix: get headscale and glauth starting up nicely again --- configuration.nix | 8 ++++---- services/glauth.nix | 8 +++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/configuration.nix b/configuration.nix index 4bdee12..0f8e640 100644 --- a/configuration.nix +++ b/configuration.nix @@ -199,8 +199,8 @@ { datastore = "plugin"; plugin = "${pkgs.glauth-sqlite}/bin/sqlite.so"; - pluginhandler = "NewSqliteHandler"; - database = "/run/glauth/glauth.db"; + pluginhandler = "NewSQLiteHandler"; + database = "/var/lib/glauth/users.db"; } ]; api = { @@ -506,8 +506,8 @@ ''; virtualHosts."dex.samsehu.perli.casa".extraConfig = '' - @connected_via_tailscale remote_ip 100.64.0.0/10 fd7a:115c:a1e0::/48 - handle @connected_via_tailscale { + @in_virtual_or_local_network remote_ip 100.64.0.0/10 fd7a:115c:a1e0::/48 private_ranges + handle @in_virtual_or_local_network { reverse_proxy localhost:5556 } respond 403 diff --git a/services/glauth.nix b/services/glauth.nix index 066ee98..2af761b 100644 --- a/services/glauth.nix +++ b/services/glauth.nix @@ -19,6 +19,11 @@ with lib; package = mkPackageOption pkgs "glauth" { }; + dataDir = mkOption { + type = types.path; + default = "/var/lib/glauth"; + }; + user = mkOption { default = "glauth"; type = types.str; @@ -53,7 +58,7 @@ with lib; users.users."${cfg.user}" = { isSystemUser = true; group = cfg.group; - home = "/var/empty"; + home = cfg.dataDir; }; users.groups."${cfg.group}" = {}; @@ -67,6 +72,7 @@ with lib; User = "${cfg.user}"; Group = "${cfg.group}"; ExecStart = ''${cfg.package}/bin/glauth -c ${settingsFormat.generate "glauth.cfg" cfg.settings}''; + StateDirectory = mkIf (cfg.dataDir == "/var/lib/glauth") [ "glauth" ]; }; }; };