nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 162 lines 4.0 kB view raw
1{ 2 lib, 3 pkgs, # for passthru.plugins 4 stdenv, 5 fetchurl, 6 pkg-config, 7 libusb-compat-0_1, 8 readline, 9 libewf, 10 perl, 11 pcre2, 12 zlib, 13 openssl, 14 file, 15 libmspack, 16 libzip, 17 lz4, 18 xxHash, 19 xz, 20 meson, 21 python3, 22 cmake, 23 ninja, 24 capstone, 25 tree-sitter, 26 zstd, 27 binutils, 28}: 29 30let 31 rizin = stdenv.mkDerivation rec { 32 pname = "rizin"; 33 version = "0.8.1"; 34 35 src = fetchurl { 36 url = "https://github.com/rizinorg/rizin/releases/download/v${version}/rizin-src-v${version}.tar.xz"; 37 hash = "sha256-7yseZSXX3DasQ1JblWdJwcyge/F8H+2LZkAtggEKTsI="; 38 }; 39 40 mesonFlags = [ 41 "-Duse_sys_capstone=enabled" 42 "-Duse_sys_magic=enabled" 43 "-Duse_sys_libzip=enabled" 44 "-Duse_sys_zlib=enabled" 45 "-Duse_sys_lz4=enabled" 46 "-Duse_sys_libzstd=enabled" 47 "-Duse_sys_lzma=enabled" 48 "-Duse_sys_xxhash=enabled" 49 "-Duse_sys_openssl=enabled" 50 "-Duse_sys_libmspack=enabled" 51 "-Duse_sys_tree_sitter=enabled" 52 "-Duse_sys_pcre2=enabled" 53 # this is needed for wrapping (adding plugins) to work 54 "-Dportable=true" 55 ]; 56 57 patches = [ 58 # Normally, Rizin only looks for files in the install prefix. With 59 # portable=true, it instead looks for files in relation to the parent 60 # of the directory of the binary file specified in /proc/self/exe, 61 # caching it. This patch replaces the entire logic to only look at 62 # the env var NIX_RZ_PREFIX 63 ./librz-wrapper-support.patch 64 ]; 65 66 nativeBuildInputs = [ 67 pkg-config 68 meson 69 (python3.withPackages ( 70 pp: with pp; [ 71 pyyaml 72 ] 73 )) 74 ninja 75 cmake 76 ]; 77 78 # meson's find_library seems to not use our compiler wrapper if static parameter 79 # is either true/false... We work around by also providing LIBRARY_PATH 80 preConfigure = '' 81 LIBRARY_PATH="" 82 for b in ${toString (map lib.getLib buildInputs)}; do 83 if [[ -d "$b/lib" ]]; then 84 LIBRARY_PATH="$b/lib''${LIBRARY_PATH:+:}$LIBRARY_PATH" 85 fi 86 done 87 export LIBRARY_PATH 88 '' 89 + lib.optionalString stdenv.hostPlatform.isDarwin '' 90 substituteInPlace binrz/rizin/macos_sign.sh \ 91 --replace 'codesign' '# codesign' 92 ''; 93 94 buildInputs = [ 95 file 96 libzip 97 capstone 98 readline 99 libusb-compat-0_1 100 libewf 101 pcre2 102 perl 103 zlib 104 lz4 105 openssl 106 libmspack 107 tree-sitter 108 xxHash 109 xz 110 zstd 111 binutils 112 ]; 113 114 postPatch = '' 115 # find_installation without arguments uses Mesons Python interpreter, 116 # which does not have any extra modules. 117 # https://github.com/mesonbuild/meson/pull/9904 118 substituteInPlace meson.build \ 119 --replace "import('python').find_installation()" "find_program('python3')" 120 121 substituteInPlace \ 122 librz/arch/p/asm/asm_x86_as.c \ 123 librz/arch/p/asm/asm_ppc_as.c \ 124 --replace '"as"' '"${binutils}/bin/as"' 125 ''; 126 127 passthru = rec { 128 plugins = { 129 jsdec = pkgs.callPackage ./jsdec.nix { 130 inherit rizin openssl; 131 }; 132 rz-ghidra = pkgs.qt6.callPackage ./rz-ghidra.nix { 133 inherit rizin openssl; 134 enableCutterPlugin = false; 135 }; 136 # sigdb isn't a real plugin, but it's separated from the main rizin 137 # derivation so that only those who need it will download it 138 sigdb = pkgs.callPackage ./sigdb.nix { }; 139 }; 140 withPlugins = 141 filter: 142 pkgs.callPackage ./wrapper.nix { 143 inherit rizin; 144 plugins = filter plugins; 145 }; 146 }; 147 148 meta = { 149 description = "UNIX-like reverse engineering framework and command-line toolset"; 150 homepage = "https://rizin.re/"; 151 license = lib.licenses.gpl3Plus; 152 mainProgram = "rizin"; 153 maintainers = with lib.maintainers; [ 154 raskin 155 makefu 156 mic92 157 ]; 158 platforms = with lib.platforms; unix; 159 }; 160 }; 161in 162rizin