2022-02-20 05:27:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
2022-06-26 10:26:21 +00:00
|
|
|
, fetchpatch
|
|
|
|
, fetchzip
|
2022-02-20 05:27:41 +00:00
|
|
|
, fetchFromGitHub
|
2022-06-26 10:26:21 +00:00
|
|
|
, butler
|
|
|
|
, electron_11
|
|
|
|
, steam-run
|
|
|
|
, makeWrapper
|
|
|
|
, copyDesktopItems
|
2022-02-20 05:27:41 +00:00
|
|
|
, makeDesktopItem
|
|
|
|
}:
|
2022-06-26 10:26:21 +00:00
|
|
|
stdenvNoCC.mkDerivation rec {
|
2022-02-20 05:27:41 +00:00
|
|
|
pname = "itch";
|
|
|
|
version = "25.5.1";
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
src = fetchzip {
|
|
|
|
url = "https://broth.itch.ovh/${pname}/linux-amd64/${version}/itch.zip";
|
|
|
|
stripRoot = false;
|
|
|
|
sha256 = "sha256-ejfS+sqhacW2h8u96W4fout3V8xrBs0SrW5w/7X83m4=";
|
2022-02-20 05:27:41 +00:00
|
|
|
};
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
patches = [
|
|
|
|
# Fixes crash while browsing the store.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "itch.patch";
|
|
|
|
url = "https://aur.archlinux.org/cgit/aur.git/plain/itch.patch?h=itch-bin&id=0b181454567029141749f870880b10093216e133";
|
|
|
|
sha256 = "sha256-gmLL/BMondSflERm0z+DuGDP56JhDXiyxEwLUavTD8Q=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
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-09-09 14:08:57 +00:00
|
|
|
icons = let sparseCheckout = "/release/images/itch-icons"; in
|
|
|
|
fetchFromGitHub {
|
|
|
|
owner = "itchio";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-DZBmf8fe0zw5uiQjNKXw8g/vU2hjNDa87z/7XuhyXog=";
|
2022-11-27 09:42:12 +00:00
|
|
|
sparseCheckout = [ sparseCheckout ];
|
2022-09-09 14:08:57 +00:00
|
|
|
} + sparseCheckout;
|
2022-06-26 10:26:21 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
|
|
|
|
|
2022-02-20 05:27:41 +00:00
|
|
|
desktopItems = [
|
|
|
|
(makeDesktopItem {
|
|
|
|
name = pname;
|
2022-06-26 10:26:21 +00:00
|
|
|
exec = "itch %U";
|
|
|
|
tryExec = pname;
|
2022-02-20 05:27:41 +00:00
|
|
|
icon = pname;
|
|
|
|
desktopName = pname;
|
2022-03-05 16:20:37 +00:00
|
|
|
mimeTypes = [ "x-scheme-handler/itchio" "x-scheme-handler/itch" ];
|
2022-02-20 05:27:41 +00:00
|
|
|
comment = "Install and play itch.io games easily";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Game" ];
|
2022-02-20 05:27:41 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
# As taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=itch-bin
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
mkdir -p $out/bin $out/share/${pname}/resources/app
|
|
|
|
cp -r resources/app "$out/share/${pname}/resources/"
|
2022-02-20 05:27:41 +00:00
|
|
|
|
2022-06-26 10:26:21 +00:00
|
|
|
install -Dm644 LICENSE -t "$out/share/licenses/$pkgname/"
|
|
|
|
install -Dm644 LICENSES.chromium.html -t "$out/share/licenses/$pkgname/"
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
for icon in $icons/icon*.png
|
2022-02-20 05:27:41 +00:00
|
|
|
do
|
2022-06-26 10:26:21 +00:00
|
|
|
iconsize="''${icon#$icons/icon}"
|
2022-02-20 05:27:41 +00:00
|
|
|
iconsize="''${iconsize%.png}"
|
|
|
|
icondir="$out/share/icons/hicolor/''${iconsize}x''${iconsize}/apps/"
|
|
|
|
install -Dm644 "$icon" "$icondir/itch.png"
|
|
|
|
done
|
2022-06-26 10:26:21 +00: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-20 05:27:41 +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;
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = lib.sourceTypes.binaryBytecode;
|
2022-02-20 05:27:41 +00:00
|
|
|
maintainers = with maintainers; [ pasqui23 ];
|
|
|
|
};
|
|
|
|
}
|