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.

96 lines
2.7 KiB
Nix
Raw Normal View History

2022-02-03 00:27:24 +00:00
{ lib
, stdenvNoCC
2022-06-02 19:29:40 +00:00
, fetchzip
2022-02-03 00:27:24 +00:00
, fetchFromGitHub
2022-06-02 19:29:40 +00:00
, butler
2023-08-10 09:30:51 +00:00
, electron
2022-06-02 19:29:40 +00:00
, steam-run
, makeWrapper
, copyDesktopItems
2022-02-03 00:27:24 +00:00
, makeDesktopItem
}:
2022-06-02 19:29:40 +00:00
stdenvNoCC.mkDerivation rec {
2022-02-03 00:27:24 +00:00
pname = "itch";
2024-02-24 10:58:36 +00:00
version = "26.1.3";
2022-02-03 00:27:24 +00:00
2023-08-10 09:30:51 +00:00
# TODO: Using kitch instead of itch, revert when possible
2022-06-02 19:29:40 +00:00
src = fetchzip {
2024-02-24 10:58:36 +00:00
url = "https://broth.itch.ovh/kitch/linux-amd64/${version}/archive/default#.zip";
2022-06-02 19:29:40 +00:00
stripRoot = false;
2024-02-24 10:58:36 +00:00
hash = "sha256-FHwbzLPMzIpyg6KyYTq6/rSNRH76dytwb9D5f9vNKkU=";
2022-02-03 00:27:24 +00:00
};
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
};
2022-08-18 09:48:29 +00:00
icons = let sparseCheckout = "/release/images/itch-icons"; in
fetchFromGitHub {
owner = "itchio";
2024-02-24 10:58:36 +00:00
repo = "itch";
2023-08-10 09:30:51 +00:00
rev = "v${version}-canary";
2024-02-24 10:58:36 +00:00
hash = "sha256-0AMyDZ5oI7/pSvudoEqXnMZJtpcKVlUSR6YVm+s4xv0=";
sparseCheckout = [ sparseCheckout ];
2022-08-18 09:48:29 +00:00
} + sparseCheckout;
2022-06-02 19:29:40 +00:00
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
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";
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
2023-08-10 09:30:51 +00:00
# TODO: Remove when the next stable Itch is stabilized
substituteInPlace ./resources/app/package.json \
--replace "kitch" "itch"
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/"
2022-08-18 09:48:29 +00:00
for icon in $icons/icon*.png
2022-02-03 00:27:24 +00:00
do
2022-06-02 19:29:40 +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 \
2022-06-02 19:29:40 +00:00
--set BROTH_USE_LOCAL butler,itch-setup \
--prefix PATH : ${butler}/bin/:${itch-setup}
2022-02-03 00:27:24 +00:00
'';
meta = with lib; {
description = "The best way to play itch.io games";
homepage = "https://github.com/itchio/itch";
license = licenses.mit;
platforms = platforms.linux;
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
2022-02-03 00:27:24 +00:00
maintainers = with maintainers; [ pasqui23 ];
2024-02-24 10:58:36 +00:00
mainProgram = "itch";
2022-02-03 00:27:24 +00:00
};
}