19 stdenv.mkDerivation (finalAttrs: {
23 src = fetchFromGitHub {
26 rev = "v${finalAttrs.version}";
27 hash = "sha256-wGOyDGY0FpAVS5+MTiKrOpDyd13ng0RLGAENW5tXuR4=";
30 # NOTE: This requires pnpm 8.10.0 or newer
31 # https://github.com/pnpm/pnpm/pull/7214
33 assert lib.versionAtLeast nodePackages.pnpm.version "8.10.0";
34 stdenvNoCC.mkDerivation {
35 pname = "${finalAttrs.pname}-pnpm-deps";
36 inherit (finalAttrs) src version patches ELECTRON_SKIP_BINARY_DOWNLOAD;
44 pnpmPatch = builtins.toJSON {
45 pnpm.supportedArchitectures = {
47 cpu = [ "x64" "arm64" ];
52 mv package.json package.json.orig
53 jq --raw-output ". * $pnpmPatch" package.json.orig > package.json
56 # https://github.com/NixOS/nixpkgs/blob/763e59ffedb5c25774387bf99bc725df5df82d10/pkgs/applications/misc/pot/default.nix#L56
58 export HOME=$(mktemp -d)
60 pnpm config set store-dir $out
61 pnpm install --frozen-lockfile --ignore-script
64 for f in $(find $out -name "*.json"); do
65 sed -i -E -e 's/"checkedAt":[0-9]+,//g' $f
66 jq --sort-keys . $f | sponge $f
72 outputHashMode = "recursive";
73 outputHash = "sha256-nNXe0vSQiQTkiRqgScKlpkpG/BJc2eIY2ueAd9sk36c=";
84 (substituteAll { inherit vencord; src = ./use_system_vencord.patch; })
87 ELECTRON_SKIP_BINARY_DOWNLOAD = 1;
90 export HOME=$(mktemp -d)
91 export STORE_PATH=$(mktemp -d)
93 cp -Tr "$pnpmDeps" "$STORE_PATH"
94 chmod -R +w "$STORE_PATH"
96 pnpm config set store-dir "$STORE_PATH"
97 pnpm install --offline --frozen-lockfile --ignore-script
98 patchShebangs node_modules/{*,.*}
103 # using `pnpm exec` here apparently makes it ignore ELECTRON_SKIP_BINARY_DOWNLOAD
104 ./node_modules/.bin/electron-builder \
106 -c.electronDist=${electron}/libexec/electron \
107 -c.electronVersion=${electron.version}
110 # this is consistent with other nixpkgs electron packages and upstream, as far as I am aware
111 # yes, upstream really packages it as "vesktop" but uses "vencorddesktop" file names
114 # this is mainly required for venmic
115 libPath = lib.makeLibraryPath [
118 gcc13Stdenv.cc.cc.lib
124 mkdir -p $out/opt/Vesktop/resources
125 cp dist/linux-*unpacked/resources/app.asar $out/opt/Vesktop/resources
128 ${libicns}/bin/icns2png -x icon.icns
129 for file in icon_*x32.png; do
130 file_suffix=''${file//icon_}
131 install -Dm0644 $file $out/share/icons/hicolor/''${file_suffix//x32.png}/apps/vencorddesktop.png
134 makeWrapper ${electron}/bin/electron $out/bin/vencorddesktop \
135 --prefix LD_LIBRARY_PATH : ${libPath} \
136 --add-flags $out/opt/Vesktop/resources/app.asar \
137 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
144 name = "vencorddesktop";
145 desktopName = "Vesktop";
146 exec = "vencorddesktop %U";
147 icon = "vencorddesktop";
148 startupWMClass = "VencordDesktop";
149 genericName = "Internet Messenger";
150 keywords = [ "discord" "vencord" "electron" "chat" ];
155 inherit (finalAttrs) pnpmDeps;
159 description = "An alternate client for Discord with Vencord built-in";
160 homepage = "https://github.com/Vencord/Vesktop";
161 license = licenses.gpl3Only;
162 maintainers = with maintainers; [ getchoo Scrumplex vgskye pluiedev ];
163 platforms = [ "x86_64-linux" "aarch64-linux" ];
164 mainProgram = "vencorddesktop";