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
|
|
|
|
, electron_11
|
|
|
|
, 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-05-03 16:05:37 +02:00
|
|
|
version = "25.6.2";
|
2022-02-03 01:27:24 +01:00
|
|
|
|
2022-06-02 21:29:40 +02:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://broth.itch.ovh/${pname}/linux-amd64/${version}/itch.zip";
|
|
|
|
stripRoot = false;
|
2023-05-03 16:05:37 +02:00
|
|
|
sha256 = "sha256-F/vaYBHCygseiKNMJ+jBy31YDIFqYToAETGUl/pkHII=";
|
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-05-03 16:05:37 +02:00
|
|
|
rev = "v25.6.1-canary"; # Use ${version} if possible
|
|
|
|
hash = "sha256-iBp7K7AW97SOlRa8N8TW2LcVtmUi9JU00fYUuPwKORc=";
|
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
|
|
|
|
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} \
|
|
|
|
--add-flags ${electron_11}/bin/electron \
|
|
|
|
--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 ];
|
|
|
|
};
|
|
|
|
}
|