about summary refs log tree commit diff
path: root/modules/nixos/syncthing.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--modules/nixos/syncthing.nix28
1 files changed, 19 insertions, 9 deletions
diff --git a/modules/nixos/syncthing.nix b/modules/nixos/syncthing.nix
index 39579f8..ecc983f 100644
--- a/modules/nixos/syncthing.nix
+++ b/modules/nixos/syncthing.nix
@@ -12,6 +12,12 @@ in {
   options.nixfiles.modules.syncthing = {
     enable = mkEnableOption "Syncthing";
 
+    port = mkOption {
+      description = "Port.";
+      type = with types; port;
+      default = 8384;
+    };
+
     domain = mkOption {
       description = "Domain name sans protocol scheme.";
       type = with types; str;
@@ -41,15 +47,16 @@ in {
         user = my.username;
         inherit (config.my) group;
 
-        dataDir = config.my.home;
+        dataDir = "${config.dirs.config}/syncthing";
+        configDir = config.services.syncthing.dataDir;
 
-        guiAddress = "127.0.0.1:8384";
+        guiAddress = "127.0.0.1:${toString cfg.port}";
 
         cert = config.secrets."syncthing-cert-${this.hostname}".path;
         key = config.secrets."syncthing-key-${this.hostname}".path;
 
-        overrideDevices = true;
-        overrideFolders = true;
+        overrideDevices = false;
+        overrideFolders = false;
 
         settings = {
           options = {
@@ -70,8 +77,11 @@ in {
           devices = mapAttrs (name: attr:
             mkIf (attr.syncthing.id != null && hasAttr "wireguard" attr) {
               inherit (attr.syncthing) id;
-              addresses = ["tcp://${name}.${config.networking.domain}:22000"];
-              introducer = this.isHeadless;
+              compression = "metadata";
+              introducer = false;
+              address = "tcp://${name}.${config.networking.domain}:22000";
+              autoAcceptFolders = true;
+              untrusted = false;
             })
           my.configurations;
 
@@ -107,17 +117,17 @@ in {
                 versioning = trashcan;
               };
               org = {
-                path = "${documents}/org"; # Configured by Emacs.
+                path = "${documents}/org";
                 devices = all;
                 versioning = simple;
               };
               roam = {
-                path = "${documents}/roam"; # Configured by Emacs.
+                path = "${documents}/roam";
                 devices = notOther;
                 versioning = simple;
               };
               elfeed = {
-                path = "${config.my.home}/.elfeed"; # Configured by Emacs.
+                path = "${config.my.home}/.elfeed";
                 devices = notOther;
                 versioning = trashcan;
               };

Consider giving Nix/NixOS a try! <3