Skip to content

Commit

Permalink
igir: 2.11.0 -> 3.0.1, adding darwin as supported platform
Browse files Browse the repository at this point in the history
  • Loading branch information
docbobo committed Jan 12, 2025
1 parent 02b34e5 commit 2a7f376
Showing 1 changed file with 56 additions and 17 deletions.
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
libuv
lz4
];

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 {} \;
'';

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;
};
}

0 comments on commit 2a7f376

Please sign in to comment.