nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 makeDesktopItem,
6 copyDesktopItems,
7 makeWrapper,
8 electron,
9 cacert,
10 gitMinimal,
11 yarn,
12}:
13stdenv.mkDerivation rec {
14 pname = "whalebird";
15 version = "6.2.2-unstable-2025-06-12";
16
17 src = fetchFromGitHub {
18 owner = "h3poteto";
19 repo = "whalebird-desktop";
20 rev = "506a1ff00188f04bffeaede0110719512c621b02";
21 hash = "sha256-jkdGwdNcF4Rbivi0TziW/ZOficbXIrxqaB+kQrNcdsc=";
22 };
23 # we cannot use fetchYarnDeps because that doesn't support yarn 2/berry lockfiles
24 offlineCache = stdenv.mkDerivation {
25 name = "whalebird-${version}-offline-cache";
26 inherit src;
27
28 nativeBuildInputs = [
29 cacert # needed for git
30 gitMinimal # needed to download git dependencies
31 yarn
32 ];
33
34 buildPhase = ''
35 export HOME=$(mktemp -d)
36 yarn config set enableTelemetry 0
37 yarn config set cacheFolder $out
38 yarn config set --json supportedArchitectures.os '[ "linux" ]'
39 yarn config set --json supportedArchitectures.cpu '[ "arm64", "x64" ]'
40 yarn
41 '';
42
43 outputHashMode = "recursive";
44 outputHash = "sha256-Lru6utVP1uHpHvL8Jg/JzEnIErsxVo7njJhsqkThktk=";
45 };
46
47 nativeBuildInputs = [
48 makeWrapper
49 copyDesktopItems
50 yarn
51 ];
52
53 desktopItems = [
54 (makeDesktopItem {
55 desktopName = "Whalebird";
56 comment = meta.description;
57 categories = [ "Network" ];
58 exec = "whalebird";
59 icon = "whalebird";
60 name = "whalebird";
61 })
62 ];
63
64 ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
65
66 buildPhase = ''
67 runHook preBuild
68
69 export HOME=$(mktemp -d)
70 yarn config set enableTelemetry 0
71 yarn config set cacheFolder ${offlineCache}
72
73 yarn --immutable-cache
74 yarn run nextron build --no-pack
75 yarn run electron-builder --dir \
76 --config electron-builder.yml \
77 -c.electronDist="${electron.dist}" \
78 -c.electronVersion=${electron.version}
79
80 runHook postBuild
81 '';
82
83 installPhase = ''
84 runHook preInstall
85
86 mkdir -p $out/opt
87 cp -r ./dist/*-unpacked $out/opt/Whalebird
88
89 # Install icons
90 # Taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=whalebird#n41
91 for i in 16 32 128 256 512; do
92 install -Dm644 "resources/icons/icon.iconset/icon_$i"x"$i.png" \
93 "$out/share/icons/hicolor/$i"x"$i/apps/whalebird.png"
94 done
95 install -Dm644 "resources/icons/icon.iconset/icon_32x32@2x.png" \
96 "$out/share/icons/hicolor/64x64/apps/whalebird.png"
97
98 makeWrapper "${electron}/bin/electron" "$out/bin/whalebird" \
99 --add-flags "$out/opt/Whalebird/resources/app.asar" \
100 --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
101
102 runHook postInstall
103 '';
104
105 meta = {
106 description = "Single-column Fediverse client for desktop";
107 mainProgram = "whalebird";
108 homepage = "https://whalebird.social";
109 changelog = "https://github.com/h3poteto/whalebird-desktop/releases/tag/v${version}";
110 license = lib.licenses.gpl3Only;
111 maintainers = with lib.maintainers; [ weathercold ];
112 platforms = [
113 "x86_64-linux"
114 "aarch64-linux"
115 ];
116 };
117}