about summary refs log tree commit diff
path: root/pkgs/applications/misc/whalebird
diff options
context:
space:
mode:
authorP <WolfangAukang@users.noreply.github.com>2021-11-01 14:17:46 -0600
committerGitHub <noreply@github.com>2021-11-01 21:17:46 +0100
commit6751e7428f20328fed076acfcbb340d0f4aa0c07 (patch)
tree3d89cc0c5abed7a85f06af67d36e8241914cd132 /pkgs/applications/misc/whalebird
parentdd49b2dbf08b0e0d62a88e70d8b53cc9c532c01c (diff)
whalebird: init at 4.4.5 (#142885)
* whalebird: init at 4.4.5

* Update pkgs/applications/misc/whalebird/default.nix

Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/misc/whalebird')
-rw-r--r--pkgs/applications/misc/whalebird/default.nix61
1 files changed, 61 insertions, 0 deletions
diff --git a/pkgs/applications/misc/whalebird/default.nix b/pkgs/applications/misc/whalebird/default.nix
new file mode 100644
index 0000000000000..0809f835668a6
--- /dev/null
+++ b/pkgs/applications/misc/whalebird/default.nix
@@ -0,0 +1,61 @@
+{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, electron
+, nodePackages, alsa-lib, gtk3, libxshmfence, mesa, nss }:
+
+stdenv.mkDerivation rec {
+  pname = "whalebird";
+  version = "4.4.5";
+
+  src = fetchurl {
+    url = "https://github.com/h3poteto/whalebird-desktop/releases/download/${version}/Whalebird-${version}-linux-x64.deb";
+    sha256 = "sha256-CIlj9Sc/hj2UMgQzfHA3iQYO6EPqcndqkNUCBecHq+E=";
+  };
+
+  nativeBuildInputs = [
+    dpkg
+    autoPatchelfHook
+    makeWrapper
+    nodePackages.asar
+  ];
+
+  buildInputs = [ alsa-lib gtk3 libxshmfence mesa nss ];
+
+  dontConfigure = true;
+
+  unpackPhase = ''
+    dpkg-deb -x ${src} ./
+  '';
+
+  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 \
+      --replace "Mo,\"tray_icon.png\"" "\"$out/opt/Whalebird/resources/build/icons/tray_icon.png\""
+    asar pack --unpack='{*.node,*.ftz,rect-overlay}' "$TMP/work" opt/Whalebird/resources/app.asar
+
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir $out
+    mv usr/share opt $out
+
+    substituteInPlace $out/share/applications/whalebird.desktop \
+      --replace '/opt/Whalebird' $out/bin
+    makeWrapper ${electron}/bin/electron $out/bin/whalebird \
+      --add-flags $out/opt/Whalebird/resources/app.asar
+
+    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;
+    maintainers = with maintainers; [ wolfangaukang ];
+    platforms = [ "x86_64-linux" ];
+  };
+}