nixpkgs/pkgs/by-name/it/itch/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

110 lines
3.0 KiB
Nix
Raw Normal View History

2024-06-18 19:28:06 +00:00
{
lib,
stdenvNoCC,
fetchzip,
fetchFromGitHub,
electron,
steam-run,
makeWrapper,
copyDesktopItems,
makeDesktopItem,
2022-02-03 00:27:24 +00:00
}:
2024-06-18 19:28:06 +00:00
let
version = "26.1.9";
2024-06-18 19:20:29 +00:00
butler = fetchzip {
url = "https://broth.itch.zone/butler/linux-amd64/15.21.0/butler.zip";
stripRoot = false;
hash = "sha256-jHni/5qf7xST6RRonP2EW8fJ6647jobzrnHe8VMx4IA=";
};
2022-06-02 19:29:40 +00:00
itch-setup = fetchzip {
url = "https://broth.itch.ovh/itch-setup/linux-amd64/1.26.0/itch-setup.zip";
stripRoot = false;
2024-02-24 10:58:36 +00:00
hash = "sha256-5MP6X33Jfu97o5R1n6Og64Bv4ZMxVM0A8lXeQug+bNA=";
2022-06-02 19:29:40 +00:00
};
2024-06-18 19:28:06 +00:00
sparseCheckout = "/release/images/itch-icons";
icons =
2022-08-18 09:48:29 +00:00
fetchFromGitHub {
2024-06-18 19:28:06 +00:00
owner = "itchio";
repo = "itch";
rev = "v${version}";
hash = "sha256-jugg+hdP0y0OkFhdQuEI9neWDuNf2p3+DQuwxe09Zck=";
sparseCheckout = [ sparseCheckout ];
}
+ sparseCheckout;
in
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "itch";
inherit version;
2022-06-02 19:29:40 +00:00
2024-06-18 19:28:06 +00:00
src = fetchzip {
url = "https://broth.itch.ovh/itch/linux-amd64/${finalAttrs.version}/archive/default#.zip";
stripRoot = false;
hash = "sha256-4k6afBgOKGs7rzXAtIBpmuQeeT/Va8/0bZgNYjuJhgI=";
};
nativeBuildInputs = [
copyDesktopItems
makeWrapper
];
2022-06-02 19:29:40 +00:00
2022-02-03 00:27:24 +00:00
desktopItems = [
(makeDesktopItem {
2024-02-24 10:58:36 +00:00
name = "itch";
2022-06-02 19:29:40 +00:00
exec = "itch %U";
2024-02-24 10:58:36 +00:00
tryExec = "itch";
icon = "itch";
desktopName = "itch";
2024-06-18 19:28:06 +00:00
mimeTypes = [
"x-scheme-handler/itchio"
"x-scheme-handler/itch"
];
2022-02-03 00:27:24 +00:00
comment = "Install and play itch.io games easily";
categories = [ "Game" ];
2022-02-03 00:27:24 +00:00
})
];
2022-06-02 19:29:40 +00:00
# As taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=itch-bin
installPhase = ''
runHook preInstall
2022-02-03 00:27:24 +00:00
2024-02-24 10:58:36 +00:00
mkdir -p $out/bin $out/share/itch/resources/app
cp -r resources/app "$out/share/itch/resources/"
2022-02-03 00:27:24 +00:00
2022-06-02 19:29:40 +00:00
install -Dm644 LICENSE -t "$out/share/licenses/$pkgname/"
install -Dm644 LICENSES.chromium.html -t "$out/share/licenses/$pkgname/"
2024-06-18 19:28:06 +00:00
for icon in ${icons}/icon*.png
2022-02-03 00:27:24 +00:00
do
2024-06-18 19:28:06 +00:00
iconsize="''${icon#${icons}/icon}"
2022-02-03 00:27:24 +00:00
iconsize="''${iconsize%.png}"
icondir="$out/share/icons/hicolor/''${iconsize}x''${iconsize}/apps/"
install -Dm644 "$icon" "$icondir/itch.png"
done
2022-06-02 19:29:40 +00:00
runHook postInstall
'';
postFixup = ''
2024-02-24 10:58:36 +00:00
makeWrapper ${steam-run}/bin/steam-run $out/bin/itch \
2023-08-10 09:30:51 +00:00
--add-flags ${electron}/bin/electron \
2024-02-24 10:58:36 +00:00
--add-flags $out/share/itch/resources/app \
--add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime}}" \
2022-06-02 19:29:40 +00:00
--set BROTH_USE_LOCAL butler,itch-setup \
2024-06-18 19:20:29 +00:00
--prefix PATH : ${butler}:${itch-setup}
2022-02-03 00:27:24 +00:00
'';
2024-06-18 19:28:06 +00:00
meta = {
2022-02-03 00:27:24 +00:00
description = "Best way to play itch.io games";
homepage = "https://github.com/itchio/itch";
2024-06-16 20:48:03 +00:00
changelog = "https://github.com/itchio/itch/releases/tag/v${version}-canary";
2024-06-18 19:28:06 +00:00
license = lib.licenses.mit;
platforms = lib.platforms.linux;
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
2024-06-18 19:28:06 +00:00
maintainers = with lib.maintainers; [ pasqui23 ];
2024-02-24 10:58:36 +00:00
mainProgram = "itch";
2022-02-03 00:27:24 +00:00
};
2024-06-18 19:28:06 +00:00
})