1 { lib, stdenv, fetchurl
2 , autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, gnugrep, asar
3 , electron, python3, alsa-lib, gtk3, libdbusmenu, libxshmfence, mesa, nss
6 stdenv.mkDerivation rec {
11 downloads = "https://github.com/h3poteto/whalebird-desktop/releases/download/v${version}";
13 if stdenv.system == "x86_64-linux" then
15 url = downloads + "/Whalebird-${version}-linux-x64.tar.bz2";
16 hash = "sha256-eufP038REwF2VwAxxI8R0S3fE8oJ+SX/CES5ozuut2w=";
18 else if stdenv.system == "aarch64-linux" then
20 url = downloads + "/Whalebird-${version}-linux-arm64.tar.bz2";
21 hash = "sha256-U0xVTUUm6wsRxYc1w4vfNtVE6o8dNzXTSi+IX4mgDEE=";
24 throw "Whalebird is not supported for ${stdenv.system}";
34 buildInputs = [ alsa-lib gtk3 libdbusmenu libxshmfence mesa nss ];
38 desktopName = "Whalebird";
39 comment = meta.description;
40 categories = [ "Network" ];
50 # remove the version/target suffix from the untar'd directory
51 mv opt/Whalebird-* opt/Whalebird
57 # Necessary steps to find the tray icon
58 # For aarch64-linux, we need to overwrite this symlink first as it points to
60 if [ "${stdenv.system}" = "aarch64-linux" ]
61 then ln -sf ${python3}/bin/python3 \
62 opt/Whalebird/resources/app.asar.unpacked/node_modules/better-sqlite3/build/node_gyp_bins/python3
64 asar extract opt/Whalebird/resources/app.asar "$TMP/work"
65 substituteInPlace "$TMP/work/dist/electron/main.js" \
66 --replace "$(grep -oE '.{2},"tray_icon.png"' "$TMP/work/dist/electron/main.js")" \
67 "\"$out/opt/Whalebird/resources/build/icons/tray_icon.png\""
68 asar pack --unpack='{*.node,*.ftz,rect-overlay}' "$TMP/work" opt/Whalebird/resources/app.asar
80 for icon in $out/opt/Whalebird/resources/build/icons/*.png; do
81 mkdir -p "$out/share/icons/hicolor/$(basename $icon .png)/apps"
82 ln -s "$icon" "$out/share/icons/hicolor/$(basename $icon .png)/apps/whalebird.png"
85 makeWrapper ${electron}/bin/electron $out/bin/whalebird \
86 --add-flags $out/opt/Whalebird/resources/app.asar \
87 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
93 description = "Electron based Mastodon, Pleroma and Misskey client for Windows, Mac and Linux";
94 homepage = "https://whalebird.social";
95 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
96 license = licenses.gpl3Only;
97 maintainers = with maintainers; [ wolfangaukang colinsane weathercold ];
98 platforms = [ "x86_64-linux" "aarch64-linux" ];