2024-03-14 17:43:13 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeDesktopItem
|
|
|
|
, copyDesktopItems
|
|
|
|
, makeWrapper
|
|
|
|
, electron
|
|
|
|
, cacert
|
|
|
|
, gitMinimal
|
|
|
|
, yarn
|
2023-06-10 23:32:11 +02:00
|
|
|
}:
|
2021-11-01 21:17:46 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "whalebird";
|
2024-03-23 23:24:43 +01:00
|
|
|
version = "6.1.0";
|
2024-03-14 17:43:13 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "h3poteto";
|
|
|
|
repo = "whalebird-desktop";
|
|
|
|
rev = "v${version}";
|
2024-03-23 23:24:43 +01:00
|
|
|
hash = "sha256-Jf+vhsfVjNrxdBkwwh3D3d2AlsGHfmEn90dq2QrKi2k=";
|
2024-03-14 17:43:13 +01:00
|
|
|
};
|
|
|
|
# we cannot use fetchYarnDeps because that doesn't support yarn 2/berry lockfiles
|
|
|
|
offlineCache = stdenv.mkDerivation {
|
|
|
|
name = "whalebird-${version}-offline-cache";
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cacert # needed for git
|
|
|
|
gitMinimal # needed to download git dependencies
|
|
|
|
yarn
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
yarn config set enableTelemetry 0
|
|
|
|
yarn config set cacheFolder $out
|
|
|
|
yarn config set --json supportedArchitectures.os '[ "linux" ]'
|
|
|
|
yarn config set --json supportedArchitectures.cpu '[ "arm64", "x64" ]'
|
|
|
|
yarn
|
|
|
|
'';
|
|
|
|
|
|
|
|
outputHashMode = "recursive";
|
2024-03-23 23:24:43 +01:00
|
|
|
outputHash = "sha256-SJCJq1vkO/jH9YgB3rV/pK4wV5Prm3sNjOj9YwL6XTw=";
|
2024-03-14 17:43:13 +01:00
|
|
|
};
|
2021-11-01 21:17:46 +01:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2022-06-04 05:16:39 +02:00
|
|
|
copyDesktopItems
|
2024-03-14 17:43:13 +01:00
|
|
|
yarn
|
2021-11-01 21:17:46 +01:00
|
|
|
];
|
|
|
|
|
2022-06-04 05:16:39 +02:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
desktopName = "Whalebird";
|
|
|
|
comment = meta.description;
|
|
|
|
categories = [ "Network" ];
|
|
|
|
exec = "whalebird";
|
|
|
|
icon = "whalebird";
|
|
|
|
name = "whalebird";
|
|
|
|
})
|
|
|
|
];
|
2021-11-01 21:17:46 +01:00
|
|
|
|
2024-03-14 17:43:13 +01:00
|
|
|
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
|
2021-11-01 21:17:46 +01:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2024-03-14 17:43:13 +01:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
yarn config set enableTelemetry 0
|
|
|
|
yarn config set cacheFolder ${offlineCache}
|
|
|
|
|
|
|
|
yarn --immutable-cache
|
|
|
|
yarn run nextron build --no-pack
|
|
|
|
yarn run electron-builder --dir \
|
|
|
|
--config electron-builder.yml \
|
|
|
|
-c.electronDist="${electron}/libexec/electron" \
|
|
|
|
-c.electronVersion=${electron.version}
|
2021-11-01 21:17:46 +01:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2024-03-14 17:43:13 +01:00
|
|
|
mkdir -p $out/opt
|
2024-03-16 02:59:23 +01:00
|
|
|
cp -r ./dist/*-unpacked $out/opt/Whalebird
|
2022-06-04 05:16:39 +02:00
|
|
|
|
2024-03-14 17:43:13 +01:00
|
|
|
# Install icons
|
|
|
|
# Taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=whalebird#n41
|
|
|
|
for i in 16 32 128 256 512; do
|
|
|
|
install -Dm644 "resources/icons/icon.iconset/icon_$i"x"$i.png" \
|
|
|
|
"$out/share/icons/hicolor/$i"x"$i/apps/whalebird.png"
|
2022-06-04 05:16:39 +02:00
|
|
|
done
|
2024-03-14 17:43:13 +01:00
|
|
|
install -Dm644 "resources/icons/icon.iconset/icon_32x32@2x.png" \
|
|
|
|
"$out/share/icons/hicolor/64x64/apps/whalebird.png"
|
2021-11-01 21:17:46 +01:00
|
|
|
|
2024-03-14 17:43:13 +01:00
|
|
|
makeWrapper "${electron}/bin/electron" "$out/bin/whalebird" \
|
|
|
|
--add-flags "$out/opt/Whalebird/resources/app.asar" \
|
2022-09-23 21:19:37 +02:00
|
|
|
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations}}"
|
2021-11-01 21:17:46 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-03-14 17:43:13 +01:00
|
|
|
description = "Single-column Fediverse client for desktop";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "whalebird";
|
2021-11-01 21:17:46 +01:00
|
|
|
homepage = "https://whalebird.social";
|
2024-03-16 02:59:23 +01:00
|
|
|
changelog = "https://github.com/h3poteto/whalebird-desktop/releases/tag/v${version}";
|
2023-06-10 23:32:11 +02:00
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ wolfangaukang colinsane weathercold ];
|
2022-06-04 05:16:39 +02:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2021-11-01 21:17:46 +01:00
|
|
|
};
|
|
|
|
}
|