23 disableBreakingUpdates =
24 runCommand "disable-breaking-updates.py"
26 pythonInterpreter = "${python3.interpreter}";
27 configDirName = lib.toLower binaryName;
28 meta.mainProgram = "disable-breaking-updates.py";
32 cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
33 substituteAllInPlace $out/bin/disable-breaking-updates.py
34 chmod +x $out/bin/disable-breaking-updates.py
55 mkdir -p $out/Applications
56 cp -r "${desktopName}.app" $out/Applications
58 # wrap executable to $out/bin
60 makeWrapper "$out/Applications/${desktopName}.app/Contents/MacOS/${binaryName}" "$out/bin/${binaryName}" \
61 --run ${lib.getExe disableBreakingUpdates}
67 lib.strings.optionalString withOpenASAR ''
68 cp -f ${openasar} $out/Applications/${desktopName}.app/Contents/Resources/app.asar
70 + lib.strings.optionalString withVencord ''
71 mv $out/Applications/${desktopName}.app/Contents/Resources/app.asar $out/Applications/${desktopName}.app/Contents/Resources/_app.asar
72 mkdir $out/Applications/${desktopName}.app/Contents/Resources/app.asar
73 echo '{"name":"discord","main":"index.js"}' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/package.json
74 echo 'require("${vencord}/patcher.js")' > $out/Applications/${desktopName}.app/Contents/Resources/app.asar/index.js
78 # make it possible to run disableBreakingUpdates standalone
79 inherit disableBreakingUpdates;
80 updateScript = writeScript "discord-update-script" ''
81 #!/usr/bin/env nix-shell
82 #!nix-shell -i bash -p curl gnugrep common-updater-scripts
85 url=$(curl -sI -o /dev/null -w '%header{location}' "https://discord.com/api/download/${branch}?platform=osx&format=dmg")
86 version=$(echo $url | grep -oP '/\K(\d+\.){2}\d+')
87 update-source-version ${
88 lib.optionalString (!stdenv.buildPlatform.isDarwin) "pkgsCross.aarch64-darwin."
89 }${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch}