From 5930433925166f9ab08d51581bcb5e91a0d1a96e Mon Sep 17 00:00:00 2001 From: wo2wz <189177184+wo2wz@users.noreply.github.com> Date: Wed, 17 Dec 2025 11:00:06 -0500 Subject: [PATCH] syncthing: init --- hosts/Drone/default.nix | 2 ++ hosts/Earthmover/default.nix | 2 ++ hosts/Swordsmachine/default.nix | 2 ++ modules/nixos/services/syncthing/default.nix | 33 ++++++++++++++++++++ modules/nixos/services/syncthing/main.nix | 29 +++++++++++++++++ modules/nixos/services/syncthing/server.nix | 25 +++++++++++++++ 6 files changed, 93 insertions(+) create mode 100644 modules/nixos/services/syncthing/default.nix create mode 100644 modules/nixos/services/syncthing/main.nix create mode 100644 modules/nixos/services/syncthing/server.nix diff --git a/hosts/Drone/default.nix b/hosts/Drone/default.nix index 3c826ac..24bf949 100755 --- a/hosts/Drone/default.nix +++ b/hosts/Drone/default.nix @@ -13,6 +13,8 @@ ../../modules/nixos/services/tailscale ../../modules/nixos/services/restic.nix ../../modules/nixos/services/sops.nix + ../../modules/nixos/services/syncthing + ../../modules/nixos/services/syncthing/server.nix ../../modules/nixos/system/minimal.nix ]; diff --git a/hosts/Earthmover/default.nix b/hosts/Earthmover/default.nix index 5e3351d..deb4884 100755 --- a/hosts/Earthmover/default.nix +++ b/hosts/Earthmover/default.nix @@ -11,6 +11,8 @@ ../../modules/nixos/programs/desktop/niri/niri/workspaces/dual-monitor.nix ../../modules/nixos/programs/gaming.nix + ../../modules/nixos/services/syncthing + ../../modules/nixos/services/syncthing/main.nix ../../modules/nixos/services/tailscale ../../modules/nixos/system/colors.nix diff --git a/hosts/Swordsmachine/default.nix b/hosts/Swordsmachine/default.nix index ade2718..0664ea4 100755 --- a/hosts/Swordsmachine/default.nix +++ b/hosts/Swordsmachine/default.nix @@ -14,6 +14,8 @@ ../../modules/nixos/programs/gaming.nix ../../modules/nixos/programs/scrcpy.nix + ../../modules/nixos/services/syncthing + ../../modules/nixos/services/syncthing/main.nix ../../modules/nixos/services/tailscale ../../modules/nixos/services/tailscale/exit-node/client.nix diff --git a/modules/nixos/services/syncthing/default.nix b/modules/nixos/services/syncthing/default.nix new file mode 100644 index 0000000..0960670 --- /dev/null +++ b/modules/nixos/services/syncthing/default.nix @@ -0,0 +1,33 @@ +{ config, ... }: + +{ + services.syncthing = { + enable = true; + settings = { + devices = { + drone = { + addresses = [ "tcp://100.65.0.1:22000" ]; + id = "CTMJ5KR-H373JVN-5TDZU7H-KKUQBW5-HIXEFXW-7OIM3LV-ZRR4IAE-RZFGDQM"; + }; + earthmover = { + addresses = [ "tcp://100.64.0.1:22000" ]; + id = "P7OPACI-4VYSXLP-6QU22HW-MTZETV4-TH55DRZ-KGHLFTY-FH6ZSGD-42V5RQN"; + }; + swordsmachine = { + addresses = [ "tcp://100.64.0.2:22000" ]; + id = "QQVUKFI-24XOQUS-SEPQCJS-FFL3K4A-RPNYYHS-BDLMF2Q-B2BKBFI-2I2D4AU"; + }; + }; + + options = { + urAccepted = -1; + crashReportingEnabled = false; + + natEnabled = false; + relaysEnabled = false; + globalAnnounceEnabled = false; + localAnnounceEnabled = false; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/nixos/services/syncthing/main.nix b/modules/nixos/services/syncthing/main.nix new file mode 100644 index 0000000..9edc2c0 --- /dev/null +++ b/modules/nixos/services/syncthing/main.nix @@ -0,0 +1,29 @@ +{ config, ... }: + +{ + services.syncthing = { + user = "wo2w"; + dataDir = "/home/wo2w"; + settings = { + folders = { + minecraft-instances = { + path = "~/.local/share/PrismLauncher/instances"; + devices = [ + "drone" + "earthmover" + "swordsmachine" + ]; + }; + + terraria = { + path = "~/.local/share/Terraria"; + devices = [ + "drone" + "earthmover" + "swordsmachine" + ]; + }; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/nixos/services/syncthing/server.nix b/modules/nixos/services/syncthing/server.nix new file mode 100644 index 0000000..e509ec0 --- /dev/null +++ b/modules/nixos/services/syncthing/server.nix @@ -0,0 +1,25 @@ +{ config, ... }: + +{ + services.syncthing.settings.folders = { + minecraft-instances = { + path = "${config.services.syncthing.dataDir}/minecraft-instances"; + type = "receiveonly"; + devices = [ + "drone" + "earthmover" + "swordsmachine" + ]; + }; + + terraria = { + path = "${config.services.syncthing.dataDir}/terraria"; + type = "receiveonly"; + devices = [ + "drone" + "earthmover" + "swordsmachine" + ]; + }; + }; +} \ No newline at end of file