From 21b809d3d2ee93b2c578c19e300f7a21f1630456 Mon Sep 17 00:00:00 2001 From: Pasquale Date: Thu, 3 Feb 2022 01:27:24 +0100 Subject: [PATCH] itch: init at 25.5.1 --- pkgs/games/itch-setup/default.nix | 24 ++++++++++++ pkgs/games/itch/default.nix | 64 +++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 4 ++ 3 files changed, 92 insertions(+) create mode 100644 pkgs/games/itch-setup/default.nix create mode 100644 pkgs/games/itch/default.nix diff --git a/pkgs/games/itch-setup/default.nix b/pkgs/games/itch-setup/default.nix new file mode 100644 index 000000000000..55d488bcaac0 --- /dev/null +++ b/pkgs/games/itch-setup/default.nix @@ -0,0 +1,24 @@ +{ 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 ]; + }; +} diff --git a/pkgs/games/itch/default.nix b/pkgs/games/itch/default.nix new file mode 100644 index 000000000000..a8cfe8f24d76 --- /dev/null +++ b/pkgs/games/itch/default.nix @@ -0,0 +1,64 @@ +{ lib +, stdenvNoCC +, fetchurl +, libnotify +, nss +, gtk3 +, fetchFromGitHub +, makeDesktopItem +, itch-setup +, runtimeShell +}: +stdenvNoCC.mkDerivation rec{ + pname = "itch"; + version = "25.5.1"; + + src = fetchFromGitHub { + owner = "itchio"; + repo = pname; + rev = "v${version}"; + hash = "sha256-Pi3l3uK4kr+N3p7fGQuqckYIzycRqJHDVX00reoSbp4="; + }; + + desktopItems = [ + (makeDesktopItem { + name = pname; + exec = pname; + icon = pname; + desktopName = pname; + mimeType = "x-scheme-handler/itchio;x-scheme-handler/itch"; + comment = "Install and play itch.io games easily"; + extraDesktopEntries = { + TryExec = "itch %U"; + Categories = "Game;"; + }; + }) + ]; + + 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 + installPhase = '' + install -Dm0777 $itchBinPath $out/bin/itch + for icon in release/images/itch-icons/icon*.png + do + iconsize="''${icon#release/images/itch-icons/icon}" + iconsize="''${iconsize%.png}" + icondir="$out/share/icons/hicolor/''${iconsize}x''${iconsize}/apps/" + install -Dm644 "$icon" "$icondir/itch.png" + done + ''; + + meta = with lib; { + description = "The best way to play itch.io games"; + homepage = "https://github.com/itchio/itch"; + license = licenses.mit; + platforms = platforms.linux; + maintainers = with maintainers; [ pasqui23 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 94d8a381348e..282c4519edf9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1923,6 +1923,10 @@ with pkgs; ipgrep = callPackage ../tools/networking/ipgrep { }; + itch = callPackage ../games/itch {}; + + itch-setup = callPackage ../games/itch-setup {}; + lastpass-cli = callPackage ../tools/security/lastpass-cli { }; lesspass-cli = callPackage ../tools/security/lesspass-cli { };