summary refs log tree commit diff
diff options
context:
space:
mode:
authorNaïm Favier <n@monade.li>2023-05-17 16:13:57 +0200
committerNaïm Favier <n@monade.li>2023-05-17 16:53:01 +0200
commit40a2df0fb0e2c194ded70b7d95a064b1bbf676e7 (patch)
treeda3d815483aa09020611444f25847e586f4671ac
parent47de2ab418dd31fa24e551051c0acc8b4a99c13b (diff)
downloadnixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.tar
nixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.tar.gz
nixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.tar.bz2
nixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.tar.lz
nixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.tar.xz
nixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.tar.zst
nixpkgs-40a2df0fb0e2c194ded70b7d95a064b1bbf676e7.zip
nixos/syncthing: fixup #226088
-rw-r--r--nixos/modules/services/networking/syncthing.nix16
-rw-r--r--nixos/tests/syncthing-init.nix5
2 files changed, 14 insertions, 7 deletions
diff --git a/nixos/modules/services/networking/syncthing.nix b/nixos/modules/services/networking/syncthing.nix
index b5ebda6da04..a8e6b0fcf6f 100644
--- a/nixos/modules/services/networking/syncthing.nix
+++ b/nixos/modules/services/networking/syncthing.nix
@@ -13,7 +13,11 @@ let
     deviceID = device.id;
   }) cfg.settings.devices;
 
-  folders = mapAttrsToList (_: folder: folder // {
+  folders = mapAttrsToList (_: folder: folder //
+    throwIf (folder?rescanInterval || folder?watch || folder?watchDelay) ''
+      The options services.syncthing.settings.folders.<name>.{rescanInterval,watch,watchDelay}
+      were removed. Please use, respectively, {rescanIntervalS,fsWatcherEnabled,fsWatcherDelayS} instead.
+    '' {
     devices = map (device:
       if builtins.isString device then
         { deviceId = cfg.settings.devices.${device}.id; }
@@ -121,10 +125,9 @@ in {
               description = mdDoc ''
                 The options element contains all other global configuration options
               '';
-              type = types.attrsOf (types.submodule ({ name, ... }: {
+              type = types.submodule ({ name, ... }: {
                 freeformType = settingsFormat.type;
                 options = {
-
                   localAnnounceEnabled = mkOption {
                     type = types.bool;
                     default = true;
@@ -176,7 +179,7 @@ in {
                     '';
                   };
                 };
-              }));
+              });
             };
 
             # device settings
@@ -344,6 +347,7 @@ in {
                       ]
                     '';
                     type = with types; nullOr (submodule {
+                      freeformType = settingsFormat.type;
                       options = {
                         type = mkOption {
                           type = enum [ "external" "simple" "staggered" "trashcan" ];
@@ -609,9 +613,7 @@ in {
           ];
         };
       };
-      syncthing-init = mkIf (
-        cfg.settings.devices != {} || cfg.folders != {} || cfg.extraOptions != {}
-      ) {
+      syncthing-init = mkIf (cfg.settings != {}) {
         description = "Syncthing configuration updater";
         requisite = [ "syncthing.service" ];
         after = [ "syncthing.service" ];
diff --git a/nixos/tests/syncthing-init.nix b/nixos/tests/syncthing-init.nix
index 435813e5806..b26c6103fd4 100644
--- a/nixos/tests/syncthing-init.nix
+++ b/nixos/tests/syncthing-init.nix
@@ -10,12 +10,17 @@ in {
     services.syncthing = {
       enable = true;
       settings = {
+        options.crashReportingEnabled = false;
         devices.testDevice = {
           id = testId;
         };
         folders.testFolder = {
           path = "/tmp/test";
           devices = [ "testDevice" ];
+          versioning = {
+            type = "simple";
+            params.keep = "10";
+          };
         };
         gui.user = "guiUser";
       };