Merge pull request #173613 from SuperSamus/itch

This commit is contained in:
Sandro 2022-06-24 16:26:54 +02:00 committed by GitHub
commit e24ce21faa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 94 additions and 51 deletions

View file

@ -1,24 +0,0 @@
{ lib, writeShellScriptBin, steam-run, fetchurl }:
let
pname = "itch-setup";
version = "1.26.0";
src = fetchurl {
url = "https://broth.itch.ovh/itch-setup/linux-amd64/${version}/unpacked/default";
hash = "sha256-bcJKqhgZK42Irx12BIvbTDMb/DHEOEXljetlDokF7x8=";
executable = true;
};
in
(writeShellScriptBin pname ''exec ${steam-run}/bin/steam-run ${src} "$@"'') // {
passthru = { inherit pname version src; };
meta = with lib; {
description = "An installer for the itch.io desktop app";
homepage = "https://github.com/itchio/itch-setup";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ pasqui23 ];
};
}

View file

@ -0,0 +1,29 @@
{ lib
, buildGoModule
, fetchFromGitHub
}:
buildGoModule rec {
pname = "butler";
version = "15.21.0";
src = fetchFromGitHub {
owner = "itchio";
repo = pname;
rev = "v${version}";
sha256 = "sha256-vciSmXR3wI3KcnC+Uz36AgI/WUfztA05MJv1InuOjJM=";
};
proxyVendor = true;
vendorSha256 = "sha256-EIl0ZFDKbZopUR22hp5a2vRUu0O1h1O953NrtoNa2x8=";
doCheck = false;
meta = with lib; {
description = "Command-line itch.io helper";
homepage = "https://github.com/itchio/butler";
license = licenses.mit;
maintainers = with maintainers; [ martfont ];
};
}

View file

@ -1,30 +1,56 @@
{ lib
, stdenvNoCC
, fetchurl
, libnotify
, nss
, gtk3
, fetchpatch
, fetchzip
, fetchFromGitHub
, butler
, electron_11
, steam-run
, makeWrapper
, copyDesktopItems
, makeDesktopItem
, itch-setup
, runtimeShell
}:
stdenvNoCC.mkDerivation rec{
stdenvNoCC.mkDerivation rec {
pname = "itch";
version = "25.5.1";
src = fetchFromGitHub {
src = fetchzip {
url = "https://broth.itch.ovh/${pname}/linux-amd64/${version}/itch.zip";
stripRoot = false;
sha256 = "sha256-ejfS+sqhacW2h8u96W4fout3V8xrBs0SrW5w/7X83m4=";
};
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=";
};
icons = let sparseCheckout = "/release/images/itch-icons"; in
fetchFromGitHub {
owner = "itchio";
repo = pname;
rev = "v${version}";
hash = "sha256-Pi3l3uK4kr+N3p7fGQuqckYIzycRqJHDVX00reoSbp4=";
};
hash = "sha256-1L6STTBHA9xL9IaERaH2OTvurTSng1D+P3KoW0ucEJc=";
inherit sparseCheckout;
} + sparseCheckout;
nativeBuildInputs = [ copyDesktopItems makeWrapper ];
desktopItems = [
(makeDesktopItem {
name = pname;
exec = pname;
tryExec = "itch %U";
exec = "itch %U";
tryExec = pname;
icon = pname;
desktopName = pname;
mimeTypes = [ "x-scheme-handler/itchio" "x-scheme-handler/itch" ];
@ -33,23 +59,33 @@ stdenvNoCC.mkDerivation rec{
})
];
itchBin = ''
#!${runtimeShell}
exec ${itch-setup}/bin/itch-setup --prefer-launch -- "$@"
'';
passAsFile = [ "itchBin" ];
# as taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=itch
# As taken from https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=itch-bin
installPhase = ''
install -Dm0777 $itchBinPath $out/bin/itch
for icon in release/images/itch-icons/icon*.png
runHook preInstall
mkdir -p $out/bin $out/share/${pname}/resources/app
cp -r resources/app "$out/share/${pname}/resources/"
install -Dm644 LICENSE -t "$out/share/licenses/$pkgname/"
install -Dm644 LICENSES.chromium.html -t "$out/share/licenses/$pkgname/"
for icon in $icons/icon*.png
do
iconsize="''${icon#release/images/itch-icons/icon}"
iconsize="''${icon#$icons/icon}"
iconsize="''${iconsize%.png}"
icondir="$out/share/icons/hicolor/''${iconsize}x''${iconsize}/apps/"
install -Dm644 "$icon" "$icondir/itch.png"
done
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}
'';
meta = with lib; {
@ -57,6 +93,7 @@ stdenvNoCC.mkDerivation rec{
homepage = "https://github.com/itchio/itch";
license = licenses.mit;
platforms = platforms.linux;
sourceProvenance = lib.sourceTypes.binaryBytecode;
maintainers = with maintainers; [ pasqui23 ];
};
}

View file

@ -619,6 +619,7 @@ mapAliases ({
iops = throw "iops was removed: upstream is gone"; # Added 2022-02-06
iproute = iproute2; # moved from top-level 2021-03-14
ipsecTools = throw "ipsecTools has benn removed, because it was no longer maintained upstream"; # Added 2021-12-15
itch-setup = throw "itch-setup has benn removed, use itch instead"; # Added 2022-06-02
### J ###

View file

@ -1139,6 +1139,8 @@ with pkgs;
asleap = callPackage ../tools/networking/asleap { };
butler = callPackage ../games/itch/butler.nix { };
cf-vault = callPackage ../tools/admin/cf-vault { };
bikeshed = python3Packages.callPackage ../applications/misc/bikeshed { };
@ -2435,8 +2437,6 @@ with pkgs;
itch = callPackage ../games/itch {};
itch-setup = callPackage ../games/itch-setup {};
lastpass-cli = callPackage ../tools/security/lastpass-cli { };
leetcode-cli = callPackage ../applications/misc/leetcode-cli { };