From: Scott Worley Date: Fri, 22 Apr 2022 15:38:30 +0000 (-0700) Subject: Follow services.syncthing.declarative rename X-Git-Url: http://git.scottworley.com/syncthing-autoregister/commitdiff_plain/22596d7545d0ae9b24e10da7aad75195c0c0d875 Follow services.syncthing.declarative rename --- diff --git a/README b/README index 64b59d0..12e0d8f 100644 --- a/README +++ b/README @@ -11,12 +11,10 @@ Modify in-place a nix module that configures syncthing device ids. This file ca { "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" = { - "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"; }; }; }; diff --git a/modules/syncthing-autoregister.nix b/modules/syncthing-autoregister.nix index ad710f6..710c7a4 100644 --- a/modules/syncthing-autoregister.nix +++ b/modules/syncthing-autoregister.nix @@ -20,7 +20,7 @@ in { description = '' Path of nix module file to write our syncthing device id into. It will be written into - services.syncthing.declarative.devices..id. This file + services.syncthing.devices..id. This file can be imported as a NixOS module. We recommend using a separate file just for this purpose. I.e., diff --git a/pkgs/syncthing-set-id.nix b/pkgs/syncthing-set-id.nix index 7982132..f20798d 100644 --- a/pkgs/syncthing-set-id.nix +++ b/pkgs/syncthing-set-id.nix @@ -44,7 +44,7 @@ writeShellScriptBin "syncthing-set-id" '' { file, name, id }: let pkgs = import { }; 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" diff --git a/tests/automatic-enrollment.nix b/tests/automatic-enrollment.nix index 9b0b76f..29a0bdf 100644 --- a/tests/automatic-enrollment.nix +++ b/tests/automatic-enrollment.nix @@ -26,7 +26,7 @@ import ({ pkgs, lib, ... }: 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 { system = builtins.currentSystem; @@ -35,7 +35,7 @@ import ({ pkgs, lib, ... }: { services.syncthing = { enable = true; - declarative.folders.forDeps.path = "/nope"; + folders.forDeps.path = "/nope"; }; } ]; @@ -71,7 +71,7 @@ import ({ pkgs, lib, ... }: 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"; };