2022-02-03 01:27:24 +01:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
2022-06-02 21:29:40 +02:00
|
|
|
, fetchzip
|
2022-02-03 01:27:24 +01:00
|
|
|
, fetchFromGitHub
|
2022-06-02 21:29:40 +02:00
|
|
|
, butler
|
2023-08-10 11:30:51 +02:00
|
|
|
, electron
|
2022-06-02 21:29:40 +02:00
|
|
|
, steam-run
|
|
|
|
, makeWrapper
|
|
|
|
, copyDesktopItems
|
2022-02-03 01:27:24 +01:00
|
|
|
, makeDesktopItem
|
|
|
|
}:
|
2022-06-02 21:29:40 +02:00
|
|
|
stdenvNoCC.mkDerivation rec {
|
2022-02-03 01:27:24 +01:00
|
|
|
pname = "itch";
|
2023-08-10 11:30:51 +02:00
|
|
|
version = "26.1.2";
|
2022-02-03 01:27:24 +01:00
|
|
|
|
2023-08-10 11:30:51 +02:00
|
|
|
# TODO: Using kitch instead of itch, revert when possible
|
2022-06-02 21:29:40 +02:00
|
|
|
src = fetchzip {
|
2023-08-10 11:30:51 +02:00
|
|
|
url = "https://broth.itch.ovh/k${pname}/linux-amd64/${version}/archive/default#.zip";
|
2022-06-02 21:29:40 +02:00
|
|
|
stripRoot = false;
|
2023-08-10 11:30:51 +02:00
|
|
|
sha256 = "sha256-thXe+glpltSiKNGIRgvOZQZPJWfDHWo3dLdziyp2BM4=";
|
2022-02-03 01:27:24 +01:00
|
|
|
};
|
|
|
|
|
2022-06-02 21:29:40 +02:00
|
|
|
itch-setup = fetchzip {
|
|
|
|
url = "https://broth.itch.ovh/itch-setup/linux-amd64/1.26.0/itch-setup.zip";
|
|
|
|
stripRoot = false;
|
|
|
|
sha256 = "sha256-5MP6X33Jfu97o5R1n6Og64Bv4ZMxVM0A8lXeQug+bNA=";
|
|
|
|
};
|
|
|
|
|
2022-08-18 11:48:29 +02:00
|
|
|
icons = let sparseCheckout = "/release/images/itch-icons"; in
|
|
|
|
fetchFromGitHub {
|
|
|
|
owner = "itchio";
|
|
|
|
repo = pname;
|
2023-08-10 11:30:51 +02:00
|
|
|
rev = "v${version}-canary";
|
|
|
|
sha256 = "sha256-veZiKs9qHge+gCEpJ119bAT56ssXJAH3HBcYkEHqBFg=";
|
2022-11-07 19:44:08 +01:00
|
|
|
sparseCheckout = [ sparseCheckout ];
|
2022-08-18 11:48:29 +02:00
|
|
|
} + sparseCheckout;
|
2022-06-02 21:29:40 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
|
|
|
|
|
2022-02-03 01:27:24 +01:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = pname;
|
2022-06-02 21:29:40 +02:00
|
|
|
exec = "itch %U";
|
|
|
|
tryExec = pname;
|
2022-02-03 01:27:24 +01:00
|
|
|
icon = pname;
|
|
|
|
desktopName = pname;
|
2022-02-22 15:56:15 +01:00
|
|
|
mimeTypes = [ "x-scheme-handler/itchio" "x-scheme-handler/itch" ];
|
2022-02-03 01:27:24 +01:00
|
|
|
comment = "Install and play itch.io games easily";
|
2022-02-22 15:56:15 +01:00
|
|
|
categories = [ "Game" ];
|
2022-02-03 01:27:24 +01:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-06-02 21:29:40 +02:00
|
|
|
# As taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=itch-bin
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-02-03 01:27:24 +01:00
|
|
|
|
2023-08-10 11:30:51 +02:00
|
|
|
# TODO: Remove when the next stable Itch is stabilized
|
|
|
|
substituteInPlace ./resources/app/package.json \
|
|
|
|
--replace "kitch" "itch"
|
|
|
|
|
2022-06-02 21:29:40 +02:00
|
|
|
mkdir -p $out/bin $out/share/${pname}/resources/app
|
|
|
|
cp -r resources/app "$out/share/${pname}/resources/"
|
2022-02-03 01:27:24 +01:00
|
|
|
|
2022-06-02 21:29:40 +02:00
|
|
|
install -Dm644 LICENSE -t "$out/share/licenses/$pkgname/"
|
|
|
|
install -Dm644 LICENSES.chromium.html -t "$out/share/licenses/$pkgname/"
|
|
|
|
|
2022-08-18 11:48:29 +02:00
|
|
|
for icon in $icons/icon*.png
|
2022-02-03 01:27:24 +01:00
|
|
|
do
|
2022-06-02 21:29:40 +02:00
|
|
|
iconsize="''${icon#$icons/icon}"
|
2022-02-03 01:27:24 +01:00
|
|
|
iconsize="''${iconsize%.png}"
|
|
|
|
icondir="$out/share/icons/hicolor/''${iconsize}x''${iconsize}/apps/"
|
|
|
|
install -Dm644 "$icon" "$icondir/itch.png"
|
|
|
|
done
|
2022-06-02 21:29:40 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
makeWrapper ${steam-run}/bin/steam-run $out/bin/${pname} \
|
2023-08-10 11:30:51 +02:00
|
|
|
--add-flags ${electron}/bin/electron \
|
2022-06-02 21:29:40 +02:00
|
|
|
--add-flags $out/share/${pname}/resources/app \
|
|
|
|
--set BROTH_USE_LOCAL butler,itch-setup \
|
|
|
|
--prefix PATH : ${butler}/bin/:${itch-setup}
|
2022-02-03 01:27:24 +01: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;
|
2023-01-02 03:48:04 +01:00
|
|
|
sourceProvenance = [ lib.sourceTypes.binaryBytecode ];
|
2022-02-03 01:27:24 +01:00
|
|
|
maintainers = with maintainers; [ pasqui23 ];
|
|
|
|
};
|
|
|
|
}
|