From b02aef6546218ca3ccae53fcd2a3566f98f99709 Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 31 Aug 2023 21:25:15 +0200 Subject: [PATCH] Syncthing: move common devices and folders into common role --- roles/common/services/default.nix | 1 + roles/common/services/syncthing.nix | 28 ++++++++++++++++++++++++++++ roles/server/syncthing.nix | 18 ------------------ 3 files changed, 29 insertions(+), 18 deletions(-) create mode 100755 roles/common/services/syncthing.nix diff --git a/roles/common/services/default.nix b/roles/common/services/default.nix index 38fca78..a045e1c 100644 --- a/roles/common/services/default.nix +++ b/roles/common/services/default.nix @@ -4,5 +4,6 @@ imports = [ ./avahi.nix ./tailscale.nix + ./syncthing.nix ]; } diff --git a/roles/common/services/syncthing.nix b/roles/common/services/syncthing.nix new file mode 100755 index 0000000..551063a --- /dev/null +++ b/roles/common/services/syncthing.nix @@ -0,0 +1,28 @@ +{ config, ... }: + +{ + # Set up devices and folders common to every device + services.syncthing = { + devices = { + "phone" = { + name = "Xiaomi Redmi Note 10 Pro"; + id = "K7KNZ5V-XREUADL-CROQXPV-6AA4H65-2VUD34Z-VQWKJ6S-LWWW4EE-XPNEZQ6"; + }; + "pc" = { + name = "Archie"; + id = "NJPX754-64AQNP3-7GZFIRZ-W2EDRJQ-27ORWYM-X5YXEXQ-ERRTRTQ-BSYD4AY"; + }; + "steamdeck" = { + name = "Steam Deck"; + id = "DLQPL74-KEQTPM5-X4PDZHB-4HLQYHV-UCMJLOB-P6W3KWU-QLJADBY-V4KEMA5"; + }; + }; + folders = { + "passwords" = { + label = "KeePassXC Passwords"; + id = "rdyaq-ex659"; + devices = [ "phone" "pc" "steamdeck"]; + }; + }; + }; +} diff --git a/roles/server/syncthing.nix b/roles/server/syncthing.nix index 5bde1f7..c8c5049 100755 --- a/roles/server/syncthing.nix +++ b/roles/server/syncthing.nix @@ -10,27 +10,9 @@ key = config.age.secrets.syncthingKey.path; cert = config.age.secrets.syncthingCert.path; guiAddress = "0.0.0.0:8384"; - devices = { - "phone" = { - id = "K7KNZ5V-XREUADL-CROQXPV-6AA4H65-2VUD34Z-VQWKJ6S-LWWW4EE-XPNEZQ6"; - name = "Xiaomi Redmi Note 10 Pro"; - }; - "pc" = { - name = "Archie"; - id = "NJPX754-64AQNP3-7GZFIRZ-W2EDRJQ-27ORWYM-X5YXEXQ-ERRTRTQ-BSYD4AY"; - addresses = [ "tcp://archie.local:22000" "tcp://192.168.0.161:22000"]; - }; - "steamdeck" = { - name = "Steam Deck"; - id = "DLQPL74-KEQTPM5-X4PDZHB-4HLQYHV-UCMJLOB-P6W3KWU-QLJADBY-V4KEMA5"; - }; - }; folders = { "passwords" = { - label = "KeePassXC Passwords"; - id = "rdyaq-ex659"; path = "${config.services.syncthing.dataDir}/passwords"; - devices = [ "phone" "pc" "steamdeck"]; }; }; };