mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
nixos/syncthing: fix escaping
This commit is contained in:
parent
1fa8dad8e7
commit
9a9ded1675
@ -55,9 +55,9 @@ let
|
||||
|
||||
# generate the new config by merging with the NixOS config options
|
||||
new_cfg=$(printf '%s\n' "$old_cfg" | ${pkgs.jq}/bin/jq -c '. * {
|
||||
"devices": (${builtins.toJSON devices}${optionalString (cfg.devices == {} || ! cfg.overrideDevices) " + .devices"}),
|
||||
"folders": (${builtins.toJSON folders}${optionalString (cfg.folders == {} || ! cfg.overrideFolders) " + .folders"})
|
||||
} * ${builtins.toJSON cfg.extraOptions}')
|
||||
"devices": ('${escapeShellArg (builtins.toJSON devices)}'${optionalString (cfg.devices == {} || ! cfg.overrideDevices) " + .devices"}),
|
||||
"folders": ('${escapeShellArg (builtins.toJSON folders)}'${optionalString (cfg.folders == {} || ! cfg.overrideFolders) " + .folders"})
|
||||
} * '${escapeShellArg (builtins.toJSON cfg.extraOptions)})
|
||||
|
||||
# send the new config
|
||||
curl -X PUT -d "$new_cfg" ${cfg.guiAddress}/rest/config
|
||||
|
@ -1,6 +1,7 @@
|
||||
import ./make-test-python.nix ({ lib, pkgs, ... }: let
|
||||
|
||||
testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
|
||||
testName = "testDevice foo'bar";
|
||||
|
||||
in {
|
||||
name = "syncthing-init";
|
||||
@ -9,12 +10,12 @@ in {
|
||||
nodes.machine = {
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
devices.testDevice = {
|
||||
devices.${testName} = {
|
||||
id = testId;
|
||||
};
|
||||
folders.testFolder = {
|
||||
path = "/tmp/test";
|
||||
devices = [ "testDevice" ];
|
||||
devices = [ testName ];
|
||||
};
|
||||
extraOptions.gui.user = "guiUser";
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user