nixpkgs/pkgs/applications/misc/whalebird/default.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

118 lines
3.1 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
makeDesktopItem,
copyDesktopItems,
makeWrapper,
electron,
cacert,
gitMinimal,
yarn,
}:
stdenv.mkDerivation rec {
pname = "whalebird";
version = "6.1.0";
src = fetchFromGitHub {
owner = "h3poteto";
repo = "whalebird-desktop";
rev = "v${version}";
hash = "sha256-Jf+vhsfVjNrxdBkwwh3D3d2AlsGHfmEn90dq2QrKi2k=";
};
# 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";
outputHash = "sha256-SJCJq1vkO/jH9YgB3rV/pK4wV5Prm3sNjOj9YwL6XTw=";
};
nativeBuildInputs = [
makeWrapper
copyDesktopItems
yarn
];
desktopItems = [
(makeDesktopItem {
desktopName = "Whalebird";
comment = meta.description;
categories = [ "Network" ];
exec = "whalebird";
icon = "whalebird";
name = "whalebird";
})
];
ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
buildPhase = ''
runHook preBuild
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.dist}" \
-c.electronVersion=${electron.version}
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out/opt
cp -r ./dist/*-unpacked $out/opt/Whalebird
# 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"
done
install -Dm644 "resources/icons/icon.iconset/icon_32x32@2x.png" \
"$out/share/icons/hicolor/64x64/apps/whalebird.png"
makeWrapper "${electron}/bin/electron" "$out/bin/whalebird" \
--add-flags "$out/opt/Whalebird/resources/app.asar" \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
runHook postInstall
'';
meta = with lib; {
description = "Single-column Fediverse client for desktop";
mainProgram = "whalebird";
homepage = "https://whalebird.social";
changelog = "https://github.com/h3poteto/whalebird-desktop/releases/tag/v${version}";
license = licenses.gpl3Only;
maintainers = with maintainers; [ weathercold ];
platforms = [
"x86_64-linux"
"aarch64-linux"
];
};
}