68 disableBreakingUpdates =
69 runCommand "disable-breaking-updates.py"
71 pythonInterpreter = "${python3.interpreter}";
72 configDirName = lib.toLower binaryName;
73 meta.mainProgram = "disable-breaking-updates.py";
77 cp ${./disable-breaking-updates.py} $out/bin/disable-breaking-updates.py
78 substituteAllInPlace $out/bin/disable-breaking-updates.py
79 chmod +x $out/bin/disable-breaking-updates.py
83 stdenv.mkDerivation rec {
109 dontWrapGApps = true;
111 libPath = lib.makeLibraryPath (
154 ++ lib.optional withTTS speechd-minimal
160 mkdir -p $out/{bin,opt/${binaryName},share/pixmaps,share/icons/hicolor/256x256/apps}
161 mv * $out/opt/${binaryName}
163 chmod +x $out/opt/${binaryName}/${binaryName}
164 patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
165 $out/opt/${binaryName}/${binaryName}
167 wrapProgramShell $out/opt/${binaryName}/${binaryName} \
168 "''${gappsWrapperArgs[@]}" \
169 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-features=WaylandWindowDecorations}}" \
170 ${lib.strings.optionalString withTTS "--add-flags \"--enable-speech-dispatcher\""} \
171 --prefix XDG_DATA_DIRS : "${gtk3}/share/gsettings-schemas/${gtk3.name}/" \
172 --prefix LD_LIBRARY_PATH : ${libPath}:$out/opt/${binaryName} \
173 --run "${lib.getExe disableBreakingUpdates}"
175 ln -s $out/opt/${binaryName}/${binaryName} $out/bin/
176 # Without || true the install would fail on case-insensitive filesystems
177 ln -s $out/opt/${binaryName}/${binaryName} $out/bin/${lib.strings.toLower binaryName} || true
179 ln -s $out/opt/${binaryName}/discord.png $out/share/pixmaps/${pname}.png
180 ln -s $out/opt/${binaryName}/discord.png $out/share/icons/hicolor/256x256/apps/${pname}.png
182 ln -s "$desktopItem/share/applications" $out/share/
188 lib.strings.optionalString withOpenASAR ''
189 cp -f ${openasar} $out/opt/${binaryName}/resources/app.asar
191 + lib.strings.optionalString withVencord ''
192 mv $out/opt/${binaryName}/resources/app.asar $out/opt/${binaryName}/resources/_app.asar
193 mkdir $out/opt/${binaryName}/resources/app.asar
194 echo '{"name":"discord","main":"index.js"}' > $out/opt/${binaryName}/resources/app.asar/package.json
195 echo 'require("${vencord}/patcher.js")' > $out/opt/${binaryName}/resources/app.asar/index.js
198 desktopItem = makeDesktopItem {
203 genericName = meta.description;
208 mimeTypes = [ "x-scheme-handler/discord" ];
212 # make it possible to run disableBreakingUpdates standalone
213 inherit disableBreakingUpdates;
214 updateScript = writeScript "discord-update-script" ''
215 #!/usr/bin/env nix-shell
216 #!nix-shell -i bash -p curl gnugrep common-updater-scripts
218 url=$(curl -sI -o /dev/null -w '%header{location}' "https://discord.com/api/download/${branch}?platform=linux&format=tar.gz")
219 version=$(echo $url | grep -oP '/\K(\d+\.){2}\d+')
220 update-source-version ${pname} "$version" --file=./pkgs/applications/networking/instant-messengers/discord/default.nix --version-key=${branch}