replace whalebird patch with upstream patch

This commit is contained in:
colin 2022-06-19 16:14:28 -07:00
parent 324e9c9b56
commit e6a88b41b2
2 changed files with 5 additions and 127 deletions

View File

@ -56,8 +56,11 @@
./nixpatches/02-rpi4-uboot.patch
# alternative to https://github.com/NixOS/nixpkgs/pull/173200
./nixpatches/04-dart-2.7.0.patch
# TODO: remove after upstreamed: https://github.com/NixOS/nixpkgs/pull/176476
./nixpatches/06-whalebird-4.6.0-aarch64.patch
# whalebird: suuport aarch64
(basePkgs.legacyPackages.${system}.fetchpatch {
url = "https://github.com/NixOS/nixpkgs/pull/176476.diff";
sha256 = "sha256-126DljM06hqPZ3fjLZ3LBZR64nFbeTfzSazEu72d4y8=";
})
# TODO: upstream
./nixpatches/07-duplicity-rich-url.patch
];

View File

@ -1,125 +0,0 @@
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 8240f18ce1b..87bba9e271b 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -2523,6 +2523,13 @@
fingerprint = "68B8 0D57 B2E5 4AC3 EC1F 49B0 B37E 0F23 7101 6A4C";
}];
};
+ colinsane = {
+ name = "Colin Sane";
+ email = "colin@uninsane.org";
+ matrix = "@colin:uninsane.org";
+ github = "uninsane";
+ githubId = 106709944;
+ };
collares = {
email = "mauricio@collares.org";
github = "collares";
diff --git a/pkgs/applications/misc/whalebird/default.nix b/pkgs/applications/misc/whalebird/default.nix
index 9b8a7f0a348..1689dbed51b 100644
--- a/pkgs/applications/misc/whalebird/default.nix
+++ b/pkgs/applications/misc/whalebird/default.nix
@@ -1,28 +1,52 @@
-{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper, electron
+{ lib, stdenv, fetchurl, autoPatchelfHook, makeDesktopItem, copyDesktopItems, makeWrapper, electron
, nodePackages, alsa-lib, gtk3, libdbusmenu, libxshmfence, mesa, nss }:
stdenv.mkDerivation rec {
pname = "whalebird";
- version = "4.5.4";
+ version = "4.6.0";
- src = fetchurl {
- url = "https://github.com/h3poteto/whalebird-desktop/releases/download/${version}/Whalebird-${version}-linux-x64.deb";
- sha256 = "048c2hpnlzjli8r1lcm7hd32qfsq4p9vkimrgc049yw9f15ndjpr";
- };
+ 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}"
+ ;
nativeBuildInputs = [
- dpkg
autoPatchelfHook
makeWrapper
+ copyDesktopItems
nodePackages.asar
];
buildInputs = [ alsa-lib gtk3 libdbusmenu libxshmfence mesa nss ];
- dontConfigure = true;
+ desktopItems = [
+ (makeDesktopItem {
+ desktopName = "Whalebird";
+ comment = meta.description;
+ categories = [ "Network" ];
+ exec = "whalebird";
+ icon = "whalebird";
+ name = "whalebird";
+ })
+ ];
unpackPhase = ''
- dpkg-deb -x ${src} ./
+ mkdir -p opt
+ tar -xf ${src} -C opt
+ # remove the version/target suffix from the untar'd directory
+ mv opt/Whalebird-* opt/Whalebird
'';
buildPhase = ''
@@ -31,7 +55,7 @@ stdenv.mkDerivation rec {
# Necessary steps to find the tray icon
asar extract opt/Whalebird/resources/app.asar "$TMP/work"
substituteInPlace $TMP/work/dist/electron/main.js \
- --replace "jo,\"tray_icon.png\"" "\"$out/opt/Whalebird/resources/build/icons/tray_icon.png\""
+ --replace "Do,\"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
@@ -41,12 +65,17 @@ stdenv.mkDerivation rec {
runHook preInstall
mkdir $out
- mv usr/share opt $out
+ 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
- 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
+ --add-flags $out/opt/Whalebird/resources/app.asar \
+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--enable-features=UseOzonePlatform --ozone-platform=wayland}}"
runHook postInstall
'';
@@ -55,7 +84,7 @@ stdenv.mkDerivation rec {
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" ];
+ maintainers = with maintainers; [ wolfangaukang colinsane ];
+ platforms = [ "x86_64-linux" "aarch64-linux" ];
};
}