Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igir: 2.11.0 -> 3.0.1-unstable-2024-09-27, adding support for darwin #372184

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions maintainers/maintainer-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5969,6 +5969,13 @@
githubId = 466723;
name = "David Reiss";
};
docbobo = {
email = "[email protected]";
github = "docbobo";
githubId = 1257060;
name = "Boris Prüßmann";
keys = [ { fingerprint = "FEA5 C6A4 7600 A6ED 0052 5169 F45C 18DC 37EC 0AB0"; } ];
};
dochang = {
email = "[email protected]";
github = "dochang";
Expand Down
73 changes: 56 additions & 17 deletions pkgs/by-name/ig/igir/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,85 @@
lib,
buildNpmPackage,
fetchFromGitHub,

# for patching bundled 7z binary from the 7zip-bin node module
# at lib/node_modules/igir/node_modules/7zip-bin/linux/x64/7za
autoPatchelfHook,
stdenv,
SDL2,
libuv,
lz4,
#tests
runCommand,
igir,
nodejs,
}:

buildNpmPackage rec {
pname = "igir";
version = "2.11.0";
version = "3.0.1-unstable-2024-09-27";

src = fetchFromGitHub {
owner = "emmercm";
repo = "igir";
rev = "v${version}";
hash = "sha256-NG0ZP8LOm7fZVecErTuLOfbp1yvXwHnwPkWTBzUJXWE=";
# v3.0.1 has a bug on linux x86 and arm64 that was fixed in a subsequent dependency update
# Using that commit instead as the other dependencies look safe.
rev = "ec6c1849fdbe418d9b08270a5c5c577b9de16779";
hash = "sha256-h95e4UpZCX+/nmk7onSmWbuUSbgqJmyCTqWculckhTs=";
};

npmDepsHash = "sha256-ADIEzr6PkGaJz27GKSVyTsrbz5zbud7BUb+OXPtP1Vo=";
npmDepsHash = "sha256-getvrta3d9yYulvFje7/zpZL0792Z72N97ngshHuwOA=";

# I have no clue why I have to do this
postPatch = ''
patchShebangs scripts/update-readme-help.sh
'';

nativeBuildInputs = [ autoPatchelfHook ];
buildInputs = [
(lib.getLib stdenv.cc.cc)
SDL2
docbobo marked this conversation as resolved.
Show resolved Hide resolved
libuv
lz4
docbobo marked this conversation as resolved.
Show resolved Hide resolved
];

nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];

postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
# Fix chdman
find $out/lib/node_modules/igir/node_modules/@emmercm/ -name chdman -executable -type f \
-exec install_name_tool -change /opt/homebrew/opt/sdl2/lib/libSDL2-2.0.0.dylib ${SDL2}/lib/libSDL2-2.0.0.dylib {} \;
# Fix maxcso
find $out/lib/node_modules/igir/node_modules/@emmercm/ -name maxcso -executable -type f \
-exec install_name_tool -change /opt/homebrew/opt/libuv/lib/libuv.1.dylib ${libuv}/lib/libuv.1.dylib {} \;
find $out/lib/node_modules/igir/node_modules/@emmercm/ -name maxcso -executable -type f \
-exec install_name_tool -change /opt/homebrew/opt/lz4/lib/liblz4.1.dylib ${lz4.lib}/lib/liblz4.1.dylib {} \;
'';
docbobo marked this conversation as resolved.
Show resolved Hide resolved

buildInputs = [ (lib.getLib stdenv.cc.cc) ];
passthru.tests =
let
igirDir = "${igir}/lib/node_modules/igir";
npxCmd = "${nodejs}/bin/npx";
in
{
chdman = runCommand "${pname}-chdman" { meta.timeout = 30; } ''
set +e
cd ${igirDir}
${npxCmd} chdman > $out
grep -q "chdman - MAME Compressed Hunks of Data (CHD) manager" $out
'';

# from lib/node_modules/igir/node_modules/@node-rs/crc32-linux-x64-musl/crc32.linux-x64-musl.node
# Irrelevant to our use
autoPatchelfIgnoreMissingDeps = [ "libc.musl-x86_64.so.1" ];
maxcso = runCommand "${pname}-maxcso" { meta.timeout = 30; } ''
set +e
cd ${igirDir}
${npxCmd} maxcso 2> $out
grep -q "maxcso v1.13.0" $out
'';
};

meta = with lib; {
meta = {
description = "Video game ROM collection manager to help filter, sort, patch, archive, and report on collections on any OS";
mainProgram = "igir";
homepage = "https://igir.io";
changelog = "https://github.com/emmercm/igir/releases/tag/${src.rev}";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ];
platforms = platforms.linux;
license = lib.licenses.gpl3Plus;
maintainers = with lib.maintainers; [ docbobo ];
platforms = with lib.platforms; linux ++ darwin;
};
}