Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 139 lines 3.0 kB view raw
1{ 2 bzip2, 3 cabextract, 4 dmg2img, 5 dtc, 6 dumpifs, 7 enableUnfree ? false, 8 fetchFromGitHub, 9 fontconfig, 10 gnutar, 11 jefferson, 12 lib, 13 lzfse, 14 lzo, 15 lzop, 16 lz4, 17 openssl_3, 18 pkg-config, 19 python3, 20 rustPlatform, 21 sasquatch, 22 sleuthkit, 23 srec2bin, 24 stdenv, 25 ubi_reader, 26 ucl, 27 uefi-firmware-parser, 28 unrar, 29 unyaffs, 30 unzip, 31 versionCheckHook, 32 vmlinux-to-elf, 33 xz, 34 zlib, 35 zstd, 36 p7zip, 37 makeBinaryWrapper, 38}: 39 40rustPlatform.buildRustPackage (finalAttrs: { 41 pname = "binwalk"; 42 version = "3.1.0"; 43 44 src = fetchFromGitHub { 45 owner = "ReFirmLabs"; 46 repo = "binwalk"; 47 tag = "v${finalAttrs.version}"; 48 hash = "sha256-em+jOnhCZH5EEJrhXTHmxiwpMcBr5oNU1+5IJ1H/oco="; 49 }; 50 51 cargoHash = "sha256-cnJVeuvNNApEHqgZDcSgqkH3DKAr8+HkqXUH9defTCA="; 52 53 nativeBuildInputs = [ 54 pkg-config 55 makeBinaryWrapper 56 ]; 57 58 # https://github.com/ReFirmLabs/binwalk/commits/master/dependencies 59 buildInputs = [ 60 bzip2 61 dtc 62 fontconfig 63 lzo 64 openssl_3 65 python3.pkgs.python-lzo 66 ucl 67 unzip 68 xz 69 zlib 70 ]; 71 72 dontUseCargoParallelTests = true; 73 74 # skip broken tests 75 checkFlags = [ 76 "--skip=binwalk::Binwalk" 77 "--skip=binwalk::Binwalk::scan" 78 ] 79 ++ lib.optionals stdenv.hostPlatform.isLinux [ 80 "--skip=binwalk::Binwalk::analyze" 81 "--skip=binwalk::Binwalk::extract" 82 ] 83 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 84 "--skip=extractors::common::Chroot::append_to_file" 85 "--skip=extractors::common::Chroot::carve_file" 86 "--skip=extractors::common::Chroot::create_block_device" 87 "--skip=extractors::common::Chroot::create_character_device" 88 "--skip=extractors::common::Chroot::create_directory" 89 "--skip=extractors::common::Chroot::create_fifo" 90 "--skip=extractors::common::Chroot::create_file" 91 "--skip=extractors::common::Chroot::create_socket" 92 "--skip=extractors::common::Chroot::create_symlink" 93 "--skip=extractors::common::Chroot::make_executable" 94 ]; 95 96 nativeInstallCheckInputs = [ versionCheckHook ]; 97 doInstallCheck = true; 98 versionCheckProgramArg = "-V"; 99 100 postInstall = '' 101 wrapProgram $out/bin/binwalk --suffix PATH : ${ 102 lib.makeBinPath ( 103 [ 104 p7zip 105 cabextract 106 dmg2img 107 dumpifs 108 jefferson 109 vmlinux-to-elf 110 lz4 111 lzfse 112 lzop 113 sasquatch 114 srec2bin 115 gnutar 116 sleuthkit 117 ubi_reader 118 uefi-firmware-parser 119 unyaffs 120 zstd 121 ] 122 ++ lib.optionals enableUnfree [ unrar ] 123 ) 124 } 125 ''; 126 127 meta = { 128 description = "Firmware Analysis Tool"; 129 homepage = "https://github.com/ReFirmLabs/binwalk"; 130 changelog = "https://github.com/ReFirmLabs/binwalk/releases/tag/v${finalAttrs.version}"; 131 license = lib.licenses.mit; 132 platforms = lib.platforms.unix; 133 maintainers = with lib.maintainers; [ 134 koral 135 felbinger 136 ]; 137 mainProgram = "binwalk"; 138 }; 139})