diff --git a/nixos/modules/services/networking/resilio.nix b/nixos/modules/services/networking/resilio.nix index cc9495bf2383..7f6358d00d0b 100644 --- a/nixos/modules/services/networking/resilio.nix +++ b/nixos/modules/services/networking/resilio.nix @@ -52,17 +52,22 @@ let runConfigPath = "/run/rslsync/config.json"; - createConfig = pkgs.writeShellScriptBin "create-resilio-config" '' - ${pkgs.jq}/bin/jq \ - '.shared_folders |= map(.secret = $ARGS.named[.dir])' \ - ${ - lib.concatMapStringsSep " \\\n " - (entry: ''--arg '${entry.dir}' "$(cat '${entry.secretFile}')"'') - sharedFoldersSecretFiles - } \ - <${configFile} \ - >${runConfigPath} - ''; + createConfig = pkgs.writeShellScriptBin "create-resilio-config" ( + if cfg.sharedFolders != [ ] then '' + ${pkgs.jq}/bin/jq \ + '.shared_folders |= map(.secret = $ARGS.named[.dir])' \ + ${ + lib.concatMapStringsSep " \\\n " + (entry: ''--arg '${entry.dir}' "$(cat '${entry.secretFile}')"'') + sharedFoldersSecretFiles + } \ + <${configFile} \ + >${runConfigPath} + '' else '' + # no secrets, passing through config + cp ${configFile} ${runConfigPath}; + '' + ); in {