]> git.scottworley.com Git - syncthing-autoregister/commitdiff
Follow services.syncthing.declarative rename
authorScott Worley <scottworley@scottworley.com>
Fri, 22 Apr 2022 15:38:30 +0000 (08:38 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 22 Apr 2022 21:42:09 +0000 (14:42 -0700)
README
modules/syncthing-autoregister.nix
pkgs/syncthing-set-id.nix
tests/automatic-enrollment.nix

diff --git a/README b/README
index 64b59d051c2b9fad9d98f260b5e77e6bd1330a2c..12e0d8f0024ba278c04de59a28eb09ed3798763d 100644 (file)
--- a/README
+++ b/README
@@ -11,12 +11,10 @@ Modify in-place a nix module that configures syncthing device ids.  This file ca
     {
       "services" = {
         "syncthing" = {
     {
       "services" = {
         "syncthing" = {
-          "declarative" = {
-            "devices" = {
-              "desktop" = {
-                "id" =
-                  "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
-              };
+          "devices" = {
+            "desktop" = {
+              "id" =
+                "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
             };
           };
         };
             };
           };
         };
@@ -31,16 +29,14 @@ Then, later, on another machine:
     {
       "services" = {
         "syncthing" = {
     {
       "services" = {
         "syncthing" = {
-          "declarative" = {
-            "devices" = {
-              "desktop" = {
-                "id" =
-                  "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
-              };
-              "laptop" = {
-                "id" =
-                  "1111111-2222222-3333333-4444444-5555555-6666666-7777777-8888888";
-              };
+          "devices" = {
+            "desktop" = {
+              "id" =
+                "1234567-89ABCDE-FGHIJKL-MNOPQRS-TUVWXYZ-0123456-789ABCD-EFGHIJK";
+            };
+            "laptop" = {
+              "id" =
+                "1111111-2222222-3333333-4444444-5555555-6666666-7777777-8888888";
             };
           };
         };
             };
           };
         };
index ad710f66e6ba450c4fb71e0ec419052f65c45a5e..710c7a42fff96f05e0a026b52b8c0435df439291 100644 (file)
@@ -20,7 +20,7 @@ in {
         description = ''
           Path of nix module file to write our syncthing
           device id into.  It will be written into
         description = ''
           Path of nix module file to write our syncthing
           device id into.  It will be written into
-          services.syncthing.declarative.devices.<hostname>.id.  This file
+          services.syncthing.devices.<hostname>.id.  This file
           can be imported as a NixOS module.
 
           We recommend using a separate file just for this purpose.  I.e.,
           can be imported as a NixOS module.
 
           We recommend using a separate file just for this purpose.  I.e.,
index 798213231d28503b9a34210cb62e2eea5ea2db9f..f20798d83508f1ecc04e34c48ae842e54c34ae15 100644 (file)
@@ -44,7 +44,7 @@ writeShellScriptBin "syncthing-set-id" ''
       { file, name, id }:
       let pkgs = import <nixpkgs> { };
       in pkgs.lib.generators.toPretty { } (pkgs.lib.recursiveUpdate (import file) {
       { file, name, id }:
       let pkgs = import <nixpkgs> { };
       in pkgs.lib.generators.toPretty { } (pkgs.lib.recursiveUpdate (import file) {
-        services.syncthing.declarative.devices."''${name}".id = id;
+        services.syncthing.devices."''${name}".id = id;
       })
     ' | ${jq}/bin/jq -r | ${nixfmt}/bin/nixfmt > "$tmp"
 
       })
     ' | ${jq}/bin/jq -r | ${nixfmt}/bin/nixfmt > "$tmp"
 
index 9b0b76f0d0a7fcdc3c951b8ecfc97d95920c8d8a..29a0bdf730cbc85c2c910038341331fc6d86d422 100644 (file)
@@ -26,7 +26,7 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
       modules = [ "${vmConfiguration}" ];
     };
 
       modules = [ "${vmConfiguration}" ];
     };
 
-    # Also include a syncthing configuration with a declarative device id
+    # Also include a syncthing configuration with a device id
     # because using this feature pulls in additional dependencies.
     evaluatedSyncthingDeclarativeConfiguration = import <nixos/nixos/lib/eval-config.nix> {
       system = builtins.currentSystem;
     # because using this feature pulls in additional dependencies.
     evaluatedSyncthingDeclarativeConfiguration = import <nixos/nixos/lib/eval-config.nix> {
       system = builtins.currentSystem;
@@ -35,7 +35,7 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
         {
           services.syncthing = {
             enable = true;
         {
           services.syncthing = {
             enable = true;
-            declarative.folders.forDeps.path = "/nope";
+            folders.forDeps.path = "/nope";
           };
         }
       ];
           };
         }
       ];
@@ -71,7 +71,7 @@ import <nixpkgs/nixos/tests/make-test-python.nix> ({ pkgs, lib, ... }:
       pkgs.writeText "configuration-with-folder.nix" ''
         { config, ... }: {
           imports = [ ${configurationWithDeviceIDs} ];
       pkgs.writeText "configuration-with-folder.nix" ''
         { config, ... }: {
           imports = [ ${configurationWithDeviceIDs} ];
-          services.syncthing.declarative.folders.foo = {
+          services.syncthing.folders.foo = {
             devices = [ "a" "b" ];
             path = "''${config.services.syncthing.dataDir}/foo";
           };
             devices = [ "a" "b" ];
             path = "''${config.services.syncthing.dataDir}/foo";
           };