From f1e10f728e6d04bce30e27ee6db94bc36b1033ef Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Wed, 4 Feb 2026 17:53:05 +0100 Subject: [PATCH] syncthing: Read device id from file by default --- hosts/desktop/default.nix | 2 -- hosts/desktop/keys/syncthing.id | 1 + hosts/laptop/default.nix | 5 +---- hosts/laptop/keys/syncthing.id | 1 + hosts/vps-private/default.nix | 1 - hosts/vps-private/keys/syncthing.id | 1 + modules/system/services/syncthing.nix | 2 +- 7 files changed, 5 insertions(+), 8 deletions(-) create mode 100644 hosts/desktop/keys/syncthing.id create mode 100644 hosts/laptop/keys/syncthing.id create mode 100644 hosts/vps-private/keys/syncthing.id diff --git a/hosts/desktop/default.nix b/hosts/desktop/default.nix index f246fdd..497f3be 100644 --- a/hosts/desktop/default.nix +++ b/hosts/desktop/default.nix @@ -15,8 +15,6 @@ }; }; - services.syncthing.deviceId = "FAJS5WM-UAWGW2U-FXCGPSP-VAUOTGM-XUKSEES-D66PMCJ-WBODJLV-XTNCRA7"; - programs.steam.enable = true; }; } diff --git a/hosts/desktop/keys/syncthing.id b/hosts/desktop/keys/syncthing.id new file mode 100644 index 0000000..39628b8 --- /dev/null +++ b/hosts/desktop/keys/syncthing.id @@ -0,0 +1 @@ +FAJS5WM-UAWGW2U-FXCGPSP-VAUOTGM-XUKSEES-D66PMCJ-WBODJLV-XTNCRA7 \ No newline at end of file diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index ecfa4b4..5931b99 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -16,10 +16,7 @@ }; }; - services = { - bluetooth.enable = true; - syncthing.deviceId = "Q4YPD3V-GXZPHSN-PT5X4PU-FBG4GX2-IASBX75-7NYMG75-4EJHBMZ-4WGDDAP"; - }; + services.bluetooth.enable = true; programs = { winboat.enable = true; diff --git a/hosts/laptop/keys/syncthing.id b/hosts/laptop/keys/syncthing.id new file mode 100644 index 0000000..c89d07d --- /dev/null +++ b/hosts/laptop/keys/syncthing.id @@ -0,0 +1 @@ +Q4YPD3V-GXZPHSN-PT5X4PU-FBG4GX2-IASBX75-7NYMG75-4EJHBMZ-4WGDDAP \ No newline at end of file diff --git a/hosts/vps-private/default.nix b/hosts/vps-private/default.nix index 9d69043..81028f2 100644 --- a/hosts/vps-private/default.nix +++ b/hosts/vps-private/default.nix @@ -28,7 +28,6 @@ dns.enable = true; syncthing = { enable = true; - deviceId = "5R2MH7T-Q2ZZS2P-ZMSQ2UJ-B6VBHES-XYLNMZ6-7FYC27L-4P7MGJ2-FY4ITQD"; isServer = true; gui.domain = "syncthing.${privateDomain}"; doBackups = true; diff --git a/hosts/vps-private/keys/syncthing.id b/hosts/vps-private/keys/syncthing.id new file mode 100644 index 0000000..a93bac7 --- /dev/null +++ b/hosts/vps-private/keys/syncthing.id @@ -0,0 +1 @@ +5R2MH7T-Q2ZZS2P-ZMSQ2UJ-B6VBHES-XYLNMZ6-7FYC27L-4P7MGJ2-FY4ITQD \ No newline at end of file diff --git a/modules/system/services/syncthing.nix b/modules/system/services/syncthing.nix index 295478c..e4137c1 100644 --- a/modules/system/services/syncthing.nix +++ b/modules/system/services/syncthing.nix @@ -19,7 +19,7 @@ in doBackups = lib.mkEnableOption ""; deviceId = lib.mkOption { type = lib.types.nonEmptyStr; - default = ""; + default = "${self}/hosts/${netCfg.hostName}/keys/syncthing.id" |> lib.readFile |> lib.trim; }; syncPort = lib.mkOption { type = lib.types.port;