From 96a9901a8e20aec586ff0d518c72a6cea54c940d Mon Sep 17 00:00:00 2001
From: Julien Malka <julien@malka.sh>
Date: Sun, 19 Jan 2025 22:54:03 +0100
Subject: [PATCH] feat(gustave): init syncthing

---
 machines/gustave/default.nix   |  1 +
 machines/gustave/syncthing.nix | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 machines/gustave/syncthing.nix

diff --git a/machines/gustave/default.nix b/machines/gustave/default.nix
index 9df1198..7dc02a7 100644
--- a/machines/gustave/default.nix
+++ b/machines/gustave/default.nix
@@ -17,6 +17,7 @@
     ./plausible.nix
     ./nextcloud.nix
     ./glance.nix
+    ./syncthing.nix
   ];
 
   machine.meta = {
diff --git a/machines/gustave/syncthing.nix b/machines/gustave/syncthing.nix
new file mode 100644
index 0000000..30b4bc1
--- /dev/null
+++ b/machines/gustave/syncthing.nix
@@ -0,0 +1,32 @@
+{ config, ... }:
+{
+  services.syncthing = {
+    enable = true;
+    user = "julien";
+    group = "users";
+    overrideDevices = true;
+    overrideFolders = true;
+
+    settings.options = {
+      urAccepted = -1;
+      listenAddresses = [ "tcp://${config.machine.meta.ips.vpn.ipv4}" ];
+    };
+
+    devices = {
+      "fischer" = {
+        id = "XEPZZIP-GX73OKE-KNGZA47-XWWGI5G-LNXPU57-BMLXK5M-VNGS5UQ-ZFIZSAK";
+      };
+    };
+    folders = {
+      "dev" = {
+        path = "/home/julien/dev";
+        devices = [
+          "fischer"
+        ];
+      };
+    };
+  };
+
+  systemd.services.syncthing.serviceConfig.StateDirectory = "syncthing";
+  systemd.services.syncthing.environment.STNODEFAULTFOLDER = "true";
+}