summary refs log tree commit diff
path: root/pkgs/development/tools
diff options
context:
space:
mode:
authorchayleaf <chayleaf-git@pavluk.org>2023-08-13 21:22:44 +0700
committerAnderson Torres <torres.anderson.85@protonmail.com>2023-08-14 13:53:09 +0000
commit2fb2f3994dec6be6196520cededa2c569b2cffa5 (patch)
tree87831880b1202816b58a16c1372f15ac4ffe34e7 /pkgs/development/tools
parent8a30e105a1c42f2b043027ad38dc996095b494e8 (diff)
downloadnixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.tar
nixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.tar.gz
nixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.tar.bz2
nixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.tar.lz
nixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.tar.xz
nixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.tar.zst
nixpkgs-2fb2f3994dec6be6196520cededa2c569b2cffa5.zip
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
Diffstat (limited to 'pkgs/development/tools')
-rw-r--r--pkgs/development/tools/analysis/rizin/cutter.nix4
-rw-r--r--pkgs/development/tools/analysis/rizin/default.nix2
-rw-r--r--pkgs/development/tools/analysis/rizin/wrapper.nix38
3 files changed, 21 insertions, 23 deletions
diff --git a/pkgs/development/tools/analysis/rizin/cutter.nix b/pkgs/development/tools/analysis/rizin/cutter.nix
index bb8ecb6e196..a74e432f2c1 100644
--- a/pkgs/development/tools/analysis/rizin/cutter.nix
+++ b/pkgs/development/tools/analysis/rizin/cutter.nix
@@ -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;
     };
   };
diff --git a/pkgs/development/tools/analysis/rizin/default.nix b/pkgs/development/tools/analysis/rizin/default.nix
index 46fe132a463..f6574afb6cf 100644
--- a/pkgs/development/tools/analysis/rizin/default.nix
+++ b/pkgs/development/tools/analysis/rizin/default.nix
@@ -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;
     };
   };
diff --git a/pkgs/development/tools/analysis/rizin/wrapper.nix b/pkgs/development/tools/analysis/rizin/wrapper.nix
index 5ddee52f232..11d046c27f6 100644
--- a/pkgs/development/tools/analysis/rizin/wrapper.nix
+++ b/pkgs/development/tools/analysis/rizin/wrapper.nix
@@ -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;
   };
 }