Unverified Commit 07515837 authored by Nico Felbinger's avatar Nico Felbinger
Browse files

binwalk: add PATH wrapper

parent f7b20f6d
Loading
Loading
Loading
Loading
+40 −24
Original line number Diff line number Diff line
@@ -33,55 +33,44 @@
  xz,
  zlib,
  zstd,
  _7zz,
  p7zip,
  makeBinaryWrapper,
}:

rustPlatform.buildRustPackage rec {
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "binwalk";
  version = "3.1.0";

  src = fetchFromGitHub {
    owner = "ReFirmLabs";
    repo = "binwalk";
    tag = "v${version}";
    tag = "v${finalAttrs.version}";
    hash = "sha256-em+jOnhCZH5EEJrhXTHmxiwpMcBr5oNU1+5IJ1H/oco=";
  };

  useFetchCargoVendor = true;
  cargoHash = "sha256-cnJVeuvNNApEHqgZDcSgqkH3DKAr8+HkqXUH9defTCA=";

  nativeBuildInputs = [ pkg-config ];
  nativeBuildInputs = [
    pkg-config
    makeBinaryWrapper
  ];

  # https://github.com/ReFirmLabs/binwalk/commits/master/dependencies
  buildInputs = [
    bzip2
    cabextract
    dmg2img
    dtc
    dumpifs
    fontconfig
    gnutar
    jefferson
    lzfse
    lzo
    lzop
    lz4
    openssl_3
    python3.pkgs.python-lzo
    sasquatch
    sleuthkit
    srec2bin
    ubi_reader
    ucl
    uefi-firmware-parser
    unyaffs
    unzip
    vmlinux-to-elf
    xz
    zlib
    zstd
    _7zz
  ] ++ lib.optionals enableUnfree [ unrar ];
  ];

  dontUseCargoParallelTests = true;

  # skip broken tests
  checkFlags =
@@ -110,10 +99,37 @@ rustPlatform.buildRustPackage rec {
  doInstallCheck = true;
  versionCheckProgramArg = "-V";

  postInstall = ''
    wrapProgram $out/bin/binwalk --suffix PATH : ${
      lib.makeBinPath (
        [
          p7zip
          cabextract
          dmg2img
          dumpifs
          jefferson
          vmlinux-to-elf
          lz4
          lzfse
          lzop
          sasquatch
          srec2bin
          gnutar
          sleuthkit
          ubi_reader
          uefi-firmware-parser
          unyaffs
          zstd
        ]
        ++ lib.optionals enableUnfree [ unrar ]
      )
    }
  '';

  meta = {
    description = "Firmware Analysis Tool";
    homepage = "https://github.com/ReFirmLabs/binwalk";
    changelog = "https://github.com/ReFirmLabs/binwalk/releases/tag/v${version}";
    changelog = "https://github.com/ReFirmLabs/binwalk/releases/tag/v${finalAttrs.version}";
    license = lib.licenses.mit;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [
@@ -122,4 +138,4 @@ rustPlatform.buildRustPackage rec {
    ];
    mainProgram = "binwalk";
  };
}
})