lol

passthrough config if there are no secrets defined

+16 -11
+16 -11
nixos/modules/services/networking/resilio.nix
··· 52 52 53 53 runConfigPath = "/run/rslsync/config.json"; 54 54 55 - createConfig = pkgs.writeShellScriptBin "create-resilio-config" '' 56 - ${pkgs.jq}/bin/jq \ 57 - '.shared_folders |= map(.secret = $ARGS.named[.dir])' \ 58 - ${ 59 - lib.concatMapStringsSep " \\\n " 60 - (entry: ''--arg '${entry.dir}' "$(cat '${entry.secretFile}')"'') 61 - sharedFoldersSecretFiles 62 - } \ 63 - <${configFile} \ 64 - >${runConfigPath} 65 - ''; 55 + createConfig = pkgs.writeShellScriptBin "create-resilio-config" ( 56 + if cfg.sharedFolders != [ ] then '' 57 + ${pkgs.jq}/bin/jq \ 58 + '.shared_folders |= map(.secret = $ARGS.named[.dir])' \ 59 + ${ 60 + lib.concatMapStringsSep " \\\n " 61 + (entry: ''--arg '${entry.dir}' "$(cat '${entry.secretFile}')"'') 62 + sharedFoldersSecretFiles 63 + } \ 64 + <${configFile} \ 65 + >${runConfigPath} 66 + '' else '' 67 + # no secrets, passing through config 68 + cp ${configFile} ${runConfigPath}; 69 + '' 70 + ); 66 71 67 72 in 68 73 {