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
|
# generate the new config by merging with the NixOS config options
|
||||||
new_cfg=$(printf '%s\n' "$old_cfg" | ${pkgs.jq}/bin/jq -c '. * {
|
new_cfg=$(printf '%s\n' "$old_cfg" | ${pkgs.jq}/bin/jq -c '. * {
|
||||||
"devices": (${builtins.toJSON devices}${optionalString (cfg.devices == {} || ! cfg.overrideDevices) " + .devices"}),
|
"devices": ('${escapeShellArg (builtins.toJSON devices)}'${optionalString (cfg.devices == {} || ! cfg.overrideDevices) " + .devices"}),
|
||||||
"folders": (${builtins.toJSON folders}${optionalString (cfg.folders == {} || ! cfg.overrideFolders) " + .folders"})
|
"folders": ('${escapeShellArg (builtins.toJSON folders)}'${optionalString (cfg.folders == {} || ! cfg.overrideFolders) " + .folders"})
|
||||||
} * ${builtins.toJSON cfg.extraOptions}')
|
} * '${escapeShellArg (builtins.toJSON cfg.extraOptions)})
|
||||||
|
|
||||||
# send the new config
|
# send the new config
|
||||||
curl -X PUT -d "$new_cfg" ${cfg.guiAddress}/rest/config
|
curl -X PUT -d "$new_cfg" ${cfg.guiAddress}/rest/config
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import ./make-test-python.nix ({ lib, pkgs, ... }: let
|
import ./make-test-python.nix ({ lib, pkgs, ... }: let
|
||||||
|
|
||||||
testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
|
testId = "7CFNTQM-IMTJBHJ-3UWRDIU-ZGQJFR6-VCXZ3NB-XUH3KZO-N52ITXR-LAIYUAU";
|
||||||
|
testName = "testDevice foo'bar";
|
||||||
|
|
||||||
in {
|
in {
|
||||||
name = "syncthing-init";
|
name = "syncthing-init";
|
||||||
@ -9,12 +10,12 @@ in {
|
|||||||
nodes.machine = {
|
nodes.machine = {
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
enable = true;
|
enable = true;
|
||||||
devices.testDevice = {
|
devices.${testName} = {
|
||||||
id = testId;
|
id = testId;
|
||||||
};
|
};
|
||||||
folders.testFolder = {
|
folders.testFolder = {
|
||||||
path = "/tmp/test";
|
path = "/tmp/test";
|
||||||
devices = [ "testDevice" ];
|
devices = [ testName ];
|
||||||
};
|
};
|
||||||
extraOptions.gui.user = "guiUser";
|
extraOptions.gui.user = "guiUser";
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user