rizin: wrapper fixes

1. Set cutterPlugins to cutter.plugins rather than rizin.plugins which
   it was set to by mistake
2. Remove Rizin binaries from Cutter wrapper, because they aren't
   actually used by Cutter and if the user needs those binaries they
   should install Rizin separately
This commit is contained in:
chayleaf 2023-08-13 21:22:44 +07:00 committed by Anderson Torres
parent 8a30e105a1
commit 2fb2f3994d
4 changed files with 22 additions and 24 deletions

View File

@ -47,8 +47,8 @@ let cutter = mkDerivation rec {
};
};
withPlugins = filter: pkgs.callPackage ./wrapper.nix {
unwrapped = cutter;
inherit rizin;
inherit rizin cutter;
isCutter = true;
plugins = filter plugins;
};
};

View File

@ -118,7 +118,7 @@ let rizin = stdenv.mkDerivation rec {
sigdb = pkgs.callPackage ./sigdb.nix { };
};
withPlugins = filter: pkgs.callPackage ./wrapper.nix {
unwrapped = rizin;
inherit rizin;
plugins = filter plugins;
};
};

View File

@ -1,20 +1,25 @@
{ lib
, makeWrapper
, symlinkJoin
, unwrapped
, plugins
# NIX_RZ_PREFIX only changes where *Rizin* locates files (plugins,
# themes, etc). But we must change it even for wrapping Cutter, because
# Cutter plugins often have associated Rizin plugins. This means that
# NIX_RZ_PREFIX must always contain Rizin files, even if we only wrap
# Cutter - so for Cutter, include Rizin to symlinkJoin paths.
, rizin ? null
, rizin
, isCutter ? false
, cutter
}:
let
unwrapped = if isCutter then cutter else rizin;
in
symlinkJoin {
name = "${unwrapped.pname}-with-plugins-${unwrapped.version}";
paths = [ unwrapped ] ++ lib.optional (rizin != null) rizin ++ plugins;
# NIX_RZ_PREFIX only changes where *Rizin* locates files (plugins,
# themes, etc). But we must change it even for wrapping Cutter, because
# Cutter plugins often have associated Rizin plugins. This means that
# $out (which NIX_RZ_PREFIX will be set to) must always contain Rizin
# files, even if we only wrap Cutter - so for Cutter, include Rizin to
# symlinkJoin paths.
paths = [ unwrapped ] ++ lib.optional isCutter rizin ++ plugins;
nativeBuildInputs = [ makeWrapper ];
@ -24,23 +29,16 @@ symlinkJoin {
postBuild = ''
rm $out/bin/*
wrapperArgs=(--set NIX_RZ_PREFIX $out)
if [ -d $out/share/rizin/cutter ]; then
wrapperArgs+=(--prefix XDG_DATA_DIRS : $out/share)
fi
wrapperArgs=(--set NIX_RZ_PREFIX $out${
lib.optionalString isCutter " --prefix XDG_DATA_DIRS : $out/share"
})
for binary in $(ls ${unwrapped}/bin); do
makeWrapper ${unwrapped}/bin/$binary $out/bin/$binary "''${wrapperArgs[@]}"
done
${lib.optionalString (rizin != null) ''
for binary in $(ls ${rizin}/bin); do
makeWrapper ${rizin}/bin/$binary $out/bin/$binary "''${wrapperArgs[@]}"
done
''}
'';
meta = unwrapped.meta // {
# prefer wrapped over unwrapped, prefer cutter wrapper over rizin wrapper
# (because cutter versions of plugins also contain rizin plugins)
priority = (unwrapped.meta.priority or 0) - (if rizin != null then 2 else 1);
# prefer wrapped over unwrapped
priority = (unwrapped.meta.priority or 0) - 1;
};
}

View File

@ -19802,7 +19802,7 @@ with pkgs;
cutter = libsForQt5.callPackage ../development/tools/analysis/rizin/cutter.nix { };
cutterPlugins = recurseIntoAttrs rizin.plugins;
cutterPlugins = recurseIntoAttrs cutter.plugins;
ragel = ragelStable;