24 stdenv.mkDerivation rec {
26 pname = "hal-hardware-analyzer";
28 src = fetchFromGitHub {
32 sha256 = "sha256-8kmYeqsmqR7tY044rZb3KuEAVGv37IObX6k1qjXWG0A=";
37 name = "de-vendor-nlohmann-json.patch";
38 # https://github.com/emsec/hal/pull/596
39 url = "https://github.com/emsec/hal/commit/f8337d554d80cfa2588512696696fd4c878dd7a3.patch";
40 hash = "sha256-QjgvcduwbFccC807JFOevlTfO3KiL9T3HSqYmh3sXAQ=";
43 name = "fix-vendored-igraph-regression.patch";
44 # https://github.com/emsec/hal/pull/596
45 url = "https://github.com/emsec/hal/commit/fe1fe74719ab4fef873a22e2b28cce0c57d570e0.patch";
46 hash = "sha256-bjbW4pr04pP0TCuSdzPcV8h6LbLWMvdGSf61RL9Ju6E=";
48 ./4.4.1-newer-spdlog-fmt-compat.patch
51 # make sure bundled dependencies don't get in the way - install also otherwise
52 # copies them in full to the output, bloating the package
55 rm -rf deps/!(abc|sanitizers-cmake|subprocess)/*
78 ++ (with python3Packages; [ python pybind11 ])
79 ++ lib.optional stdenv.cc.isClang llvmPackages.openmp
82 cmakeFlags = with lib.versions; [
83 "-DHAL_VERSION_RETURN=${version}"
84 "-DHAL_VERSION_MAJOR=${major version}"
85 "-DHAL_VERSION_MINOR=${minor version}"
86 "-DHAL_VERSION_PATCH=${patch version}"
87 "-DHAL_VERSION_TWEAK=0"
88 "-DHAL_VERSION_ADDITIONAL_COMMITS=0"
89 "-DHAL_VERSION_DIRTY=false"
90 "-DHAL_VERSION_BROKEN=false"
91 "-DENABLE_INSTALL_LDCONFIG=off"
92 "-DUSE_VENDORED_PYBIND11=off"
93 "-DUSE_VENDORED_SPDLOG=off"
94 "-DUSE_VENDORED_QUAZIP=off"
95 "-DUSE_VENDORED_IGRAPH=off"
96 "-DUSE_VENDORED_NLOHMANN_JSON=off"
97 "-DBUILD_ALL_PLUGINS=on"
99 # needed for macos build - this is why we use wrapQtAppsHook instead of
100 # the qt mkDerivation - the latter forcibly overrides this.
101 cmakeBuildType = "MinSizeRel";
103 # https://github.com/emsec/hal/issues/598
104 NIX_CFLAGS_COMPILE = lib.optional stdenv.hostPlatform.isAarch64 "-flax-vector-conversions";
106 # some plugins depend on other plugins and need to be able to load them
107 postFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
108 find $out/lib/hal_plugins -name '*.so*' | while read -r f ; do
109 patchelf --set-rpath "$(patchelf --print-rpath "$f"):$out/lib/hal_plugins" "$f"
114 description = "Comprehensive reverse engineering and manipulation framework for gate-level netlists";
116 homepage = "https://github.com/emsec/hal";
117 license = licenses.mit;
118 platforms = platforms.unix;
119 maintainers = with maintainers; [ ris shamilton ];