From 5be9e76486a6aec7b2f99ee6c77eede6cc57960a Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Fri, 13 Jun 2025 22:22:33 +0200 Subject: [PATCH] Serve tailscale gui over caddy --- hosts/alto/default.nix | 7 +++++-- modules/system/services/syncthing/default.nix | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hosts/alto/default.nix b/hosts/alto/default.nix index e995cdb..e1973c4 100644 --- a/hosts/alto/default.nix +++ b/hosts/alto/default.nix @@ -17,11 +17,11 @@ syncthing = { enable = true; - deviceId = "5R2MH7T-Q2ZZS2P-ZMSQ2UJ-B6VBHES-XYLNMZ6-7FYC27L-4P7MGJ2-FY4ITQD"; isServer = true; + deviceId = "5R2MH7T-Q2ZZS2P-ZMSQ2UJ-B6VBHES-XYLNMZ6-7FYC27L-4P7MGJ2-FY4ITQD"; + gui.domain = "syncthing.${config.custom.services.tailscale.domain}"; backups.enable = true; }; - nextcloud = { enable = true; domain = "cloud.${config.custom.services.tailscale.domain}"; @@ -34,6 +34,9 @@ }; caddy.virtualHosts = { + syncthing-gui = { + inherit (config.custom.services.syncthing.gui) domain port; + }; nextcloud = { inherit (config.custom.services.nextcloud) domain port; }; diff --git a/modules/system/services/syncthing/default.nix b/modules/system/services/syncthing/default.nix index 804095a..9b71e1c 100644 --- a/modules/system/services/syncthing/default.nix +++ b/modules/system/services/syncthing/default.nix @@ -20,9 +20,15 @@ in type = lib.types.port; default = 22000; }; - guiPort = lib.mkOption { - type = lib.types.port; - default = 8384; + gui = { + domain = lib.mkOption { + type = lib.types.nonEmptyStr; + default = ""; + }; + port = lib.mkOption { + type = lib.types.port; + default = 8384; + }; }; }; @@ -41,7 +47,7 @@ in group = lib.mkIf (!cfg.isServer) "users"; dataDir = lib.mkIf (!cfg.isServer) "/home/seb"; - guiAddress = lib.mkIf cfg.isServer "0.0.0.0:${toString cfg.guiPort}"; + guiAddress = lib.mkIf cfg.isServer "127.0.0.1:${toString cfg.gui.port}"; settings = { # Get the devices and their ids from the configs of the other hosts