Commit 2fb2f399 authored by chayleaf's avatar chayleaf Committed by Anderson Torres
Browse files

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
parent 8a30e105
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
    };
  };
+1 −1
Original line number Diff line number Diff line
@@ -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;
    };
  };
+18 −20
Original line number Diff line number Diff line
{ 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;
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -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;