about summary refs log tree commit diff
path: root/modules/nixos/syncthing.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-06-01 02:39:11 +0300
committerAzat Bahawi <azat@bahawi.net>2023-06-01 02:39:11 +0300
commitec144aaa8fb8c5a4b65e60bbc31a52d71d6e646a (patch)
tree27a5a684b2def43d0ba00fbb890ed26f572fb060 /modules/nixos/syncthing.nix
parent2023-05-21 (diff)
2023-06-01
Diffstat (limited to '')
-rw-r--r--modules/nixos/syncthing.nix120
1 files changed, 60 insertions, 60 deletions
diff --git a/modules/nixos/syncthing.nix b/modules/nixos/syncthing.nix
index faf6723..24bfbb6 100644
--- a/modules/nixos/syncthing.nix
+++ b/modules/nixos/syncthing.nix
@@ -50,73 +50,68 @@ in {
         overrideDevices = true;
         overrideFolders = true;
 
-        settings = {
-          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;
-            })
-          my.configurations;
+        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;
+          })
+        my.configurations;
 
-          folders = let
-            filterDevices = f:
-              attrNames (filterAttrs (_: attr:
-                (attr.hostname != this.hostname)
-                && (attr.syncthing.id != null)
-                && f attr)
-              my.configurations);
-            all = filterDevices (_: true);
-            notHeadless = filterDevices (attr: !attr.isHeadless);
-            notOther = filterDevices (attr: !attr.isOther);
+        folders = let
+          filterDevices = f:
+            attrNames (filterAttrs (_: attr:
+              (attr.hostname != this.hostname)
+              && (attr.syncthing.id != null)
+              && f attr)
+            my.configurations);
+          all = filterDevices (_: true);
+          notHeadless = filterDevices (attr: !attr.isHeadless);
+          notOther = filterDevices (attr: !attr.isOther);
 
-            simple = {
-              type = "simple";
-              params.keep = "5";
+          simple = {
+            type = "simple";
+            params.keep = "5";
+          };
+          trashcan = {
+            type = "trashcan";
+            params.cleanoutDays = "7";
+          };
+        in
+          with config.hm.xdg.userDirs; {
+            share = {
+              path = publicShare;
+              devices = notHeadless;
+              versioning = trashcan;
             };
-            trashcan = {
-              type = "trashcan";
-              params.cleanoutDays = "7";
+            pass = {
+              path = config.hm.programs.password-store.settings.PASSWORD_STORE_DIR;
+              devices = notOther;
+              versioning = trashcan;
             };
-          in
-            with config.hm.xdg.userDirs; {
-              share = {
-                path = publicShare;
-                devices = notHeadless;
-                versioning = trashcan;
-              };
-              pass = {
-                path = config.hm.programs.password-store.settings.PASSWORD_STORE_DIR;
-                devices = notOther;
-                versioning = trashcan;
-              };
-              org = {
-                path = "${documents}/org";
-                devices = all;
-                versioning = simple;
-              };
-              roam = {
-                path = "${documents}/roam";
-                devices = notOther;
-                versioning = simple;
-              };
-              elfeed = {
-                path = "${config.my.home}/.elfeed";
-                devices = notOther;
-                versioning = trashcan;
-              };
-              books = {
-                path = "${documents}/books";
-                devices = notOther;
-                versioning = trashcan;
-              };
+            org = {
+              path = "${documents}/org";
+              devices = all;
+              versioning = simple;
+            };
+            roam = {
+              path = "${documents}/roam";
+              devices = notOther;
+              versioning = simple;
+            };
+            elfeed = {
+              path = "${config.my.home}/.elfeed";
+              devices = notOther;
+              versioning = trashcan;
+            };
+            books = {
+              path = "${documents}/books";
+              devices = notOther;
+              versioning = trashcan;
             };
-
-          gui = {
-            insecureAdminAccess = true;
-            insecureSkipHostcheck = this.isHeadless;
           };
 
+        extraOptions = {
           options = {
             testOption = false;
             autoUpgradeIntervalH = 0;
@@ -128,6 +123,11 @@ in {
             stunKeepaliveStartS = 0;
             urAccepted = -1;
           };
+
+          gui = {
+            insecureAdminAccess = true;
+            insecureSkipHostcheck = this.isHeadless;
+          };
         };
       };
 

Consider giving Nix/NixOS a try! <3