2022-06-04 04:16:39 +01:00
|
|
|
{ lib, stdenv, fetchurl, autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, electron
|
2022-05-09 13:05:53 +01:00
|
|
|
, nodePackages, alsa-lib, gtk3, libdbusmenu, libxshmfence, mesa, nss }:
|
2021-11-01 20:17:46 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "whalebird";
|
2022-06-04 04:16:39 +01:00
|
|
|
version = "4.6.0";
|
2021-11-01 20:17:46 +00:00
|
|
|
|
2022-06-04 04:16:39 +01:00
|
|
|
src = let
|
|
|
|
downloads = "https://github.com/h3poteto/whalebird-desktop/releases/download/${version}";
|
|
|
|
in
|
|
|
|
if stdenv.system == "x86_64-linux" then
|
|
|
|
fetchurl {
|
|
|
|
url = downloads + "/Whalebird-${version}-linux-x64.tar.bz2";
|
|
|
|
sha256 = "02f2f4b7184494926ef58523174acfa23738d5f27b4956d094836a485047c2f8";
|
|
|
|
}
|
|
|
|
else if stdenv.system == "aarch64-linux" then
|
|
|
|
fetchurl {
|
|
|
|
url = downloads + "/Whalebird-${version}-linux-arm64.tar.bz2";
|
|
|
|
sha256 = "de0cdf7cbd6f0305100a2440e2559ddce0a5e4ad73a341874d6774e23dc76974";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
throw "Whalebird is not supported for ${stdenv.system}";
|
2021-11-01 20:17:46 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
makeWrapper
|
2022-06-04 04:16:39 +01:00
|
|
|
copyDesktopItems
|
2021-11-01 20:17:46 +00:00
|
|
|
nodePackages.asar
|
|
|
|
];
|
|
|
|
|
2022-05-09 13:05:53 +01:00
|
|
|
buildInputs = [ alsa-lib gtk3 libdbusmenu libxshmfence mesa nss ];
|
2021-11-01 20:17:46 +00:00
|
|
|
|
2022-06-04 04:16:39 +01:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
desktopName = "Whalebird";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = [ "Network" ];
|
|
|
|
exec = "whalebird";
|
|
|
|
icon = "whalebird";
|
|
|
|
name = "whalebird";
|
|
|
|
})
|
|
|
|
];
|
2021-11-01 20:17:46 +00:00
|
|
|
|
|
|
|
unpackPhase = ''
|
2022-06-04 04:16:39 +01:00
|
|
|
mkdir -p opt
|
|
|
|
tar -xf ${src} -C opt
|
|
|
|
# remove the version/target suffix from the untar'd directory
|
|
|
|
mv opt/Whalebird-* opt/Whalebird
|
2021-11-01 20:17:46 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
# Necessary steps to find the tray icon
|
|
|
|
asar extract opt/Whalebird/resources/app.asar "$TMP/work"
|
|
|
|
substituteInPlace $TMP/work/dist/electron/main.js \
|
2022-06-04 04:16:39 +01:00
|
|
|
--replace "Do,\"tray_icon.png\"" "\"$out/opt/Whalebird/resources/build/icons/tray_icon.png\""
|
2021-11-01 20:17:46 +00:00
|
|
|
asar pack --unpack='{*.node,*.ftz,rect-overlay}' "$TMP/work" opt/Whalebird/resources/app.asar
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mkdir $out
|
2022-06-04 04:16:39 +01:00
|
|
|
mv opt $out
|
|
|
|
|
|
|
|
# install icons
|
|
|
|
for icon in $out/opt/Whalebird/resources/build/icons/*.png; do
|
|
|
|
mkdir -p "$out/share/icons/hicolor/$(basename $icon .png)/apps"
|
|
|
|
ln -s "$icon" "$out/share/icons/hicolor/$(basename $icon .png)/apps/whalebird.png"
|
|
|
|
done
|
2021-11-01 20:17:46 +00:00
|
|
|
|
|
|
|
makeWrapper ${electron}/bin/electron $out/bin/whalebird \
|
2022-06-04 04:16:39 +01:00
|
|
|
--add-flags $out/opt/Whalebird/resources/app.asar \
|
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
|
2021-11-01 20:17:46 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Electron based Mastodon, Pleroma and Misskey client for Windows, Mac and Linux";
|
|
|
|
homepage = "https://whalebird.social";
|
|
|
|
license = licenses.mit;
|
2022-06-04 04:16:39 +01:00
|
|
|
maintainers = with maintainers; [ wolfangaukang colinsane ];
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2021-11-01 20:17:46 +00:00
|
|
|
};
|
|
|
|
}
|