e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
86 lines
1.6 KiB
Nix
86 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
stdenv,
|
|
zlib,
|
|
xz,
|
|
gzip,
|
|
bzip2,
|
|
gnutar,
|
|
p7zip,
|
|
cabextract,
|
|
cramfsprogs,
|
|
cramfsswap,
|
|
sasquatch,
|
|
setuptools,
|
|
squashfsTools,
|
|
matplotlib,
|
|
pycrypto,
|
|
pyqtgraph,
|
|
pyqt5,
|
|
pytestCheckHook,
|
|
visualizationSupport ? false,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "binwalk${lib.optionalString visualizationSupport "-full"}";
|
|
version = "2.4.2";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "OSPG";
|
|
repo = "binwalk";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-IFq/XotW3bbf3obWXRK6Nw1KQDqyFHb4tcA09Twg8SQ=";
|
|
};
|
|
|
|
build-system = [ setuptools ];
|
|
|
|
propagatedBuildInputs =
|
|
[
|
|
zlib
|
|
xz
|
|
gzip
|
|
bzip2
|
|
gnutar
|
|
p7zip
|
|
cabextract
|
|
squashfsTools
|
|
xz
|
|
pycrypto
|
|
]
|
|
++ lib.optionals visualizationSupport [
|
|
matplotlib
|
|
pyqtgraph
|
|
pyqt5
|
|
]
|
|
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
|
|
cramfsprogs
|
|
cramfsswap
|
|
sasquatch
|
|
];
|
|
|
|
# setup.py only installs version.py during install, not test
|
|
postPatch = ''
|
|
echo '__version__ = "${version}"' > src/binwalk/core/version.py
|
|
'';
|
|
|
|
# binwalk wants to access ~/.config/binwalk/magic
|
|
preCheck = ''
|
|
HOME=$(mktemp -d)
|
|
'';
|
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
|
|
|
pythonImportsCheck = [ "binwalk" ];
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/OSPG/binwalk";
|
|
description = "Tool for searching a given binary image for embedded files";
|
|
mainProgram = "binwalk";
|
|
maintainers = [ maintainers.koral ];
|
|
license = licenses.mit;
|
|
};
|
|
}
|