From 343a8033bd3b4963db0a29fe6fea717e71ccbc65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 24 Sep 2025 03:31:49 -0700 Subject: [PATCH 1/4] hal-hardware-analyzer: 4.4.1 -> 4.5.0 Diff: https://github.com/emsec/hal/compare/v4.4.1...v4.5.0 Changelog: https://github.com/emsec/hal/releases/tag/v4.5.0 --- .../4.4.1-newer-spdlog-fmt-compat.patch | 28 ------------------- .../hal-hardware-analyzer/default.nix | 25 +++-------------- ...resynthesis-fix-narrowing-conversion.patch | 13 --------- 3 files changed, 4 insertions(+), 62 deletions(-) delete mode 100644 pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch delete mode 100644 pkgs/applications/science/electronics/hal-hardware-analyzer/resynthesis-fix-narrowing-conversion.patch diff --git a/pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch b/pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch deleted file mode 100644 index 016e74415644..000000000000 --- a/pkgs/applications/science/electronics/hal-hardware-analyzer/4.4.1-newer-spdlog-fmt-compat.patch +++ /dev/null @@ -1,28 +0,0 @@ -compatibility with newer spdlog/fmt versions - -diff --git a/plugins/module_identification/src/api/module_identification.cpp b/plugins/module_identification/src/api/module_identification.cpp -index 808875e8a68..3cf3cf1fb8b 100644 ---- a/plugins/module_identification/src/api/module_identification.cpp -+++ b/plugins/module_identification/src/api/module_identification.cpp -@@ -406,7 +406,7 @@ namespace hal - - const u32 num_threads = std::min(config.m_max_thread_count, std::thread::hardware_concurrency() - 1); - -- log_info("module_identification", "running with {} threads and {} multithreading priority", num_threads, config.m_multithreading_priority); -+ log_info("module_identification", "running with {} threads and {} multithreading priority", num_threads, fmt::underlying(config.m_multithreading_priority)); - - auto stats = Statistics(); - -diff --git a/plugins/z3_utils/src/simplification.cpp b/plugins/z3_utils/src/simplification.cpp -index d64cab665f2..561fa7f1a23 100644 ---- a/plugins/z3_utils/src/simplification.cpp -+++ b/plugins/z3_utils/src/simplification.cpp -@@ -617,7 +617,7 @@ namespace hal - return false; - - default: { -- log_error("z3_utils", "commutative check not implemeted for type {}!", t); -+ log_error("z3_utils", "commutative check not implemeted for type {}!", fmt::underlying(t)); - return false; - } - } diff --git a/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix b/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix index 4fed26932415..136834c6a294 100644 --- a/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix +++ b/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix @@ -4,7 +4,6 @@ boost, cmake, fetchFromGitHub, - fetchpatch, graphviz, igraph, llvmPackages, @@ -23,33 +22,16 @@ }: stdenv.mkDerivation rec { - version = "4.4.1"; + version = "4.5.0"; pname = "hal-hardware-analyzer"; src = fetchFromGitHub { owner = "emsec"; repo = "hal"; - rev = "v${version}"; - sha256 = "sha256-8kmYeqsmqR7tY044rZb3KuEAVGv37IObX6k1qjXWG0A="; + tag = "v${version}"; + hash = "sha256-4HLM/7JCDxWRWusGL4lUa8KXCn9pe3Vkr+lOxHOraNU="; }; - patches = [ - (fetchpatch { - name = "de-vendor-nlohmann-json.patch"; - # https://github.com/emsec/hal/pull/596 - url = "https://github.com/emsec/hal/commit/f8337d554d80cfa2588512696696fd4c878dd7a3.patch"; - hash = "sha256-QjgvcduwbFccC807JFOevlTfO3KiL9T3HSqYmh3sXAQ="; - }) - (fetchpatch { - name = "fix-vendored-igraph-regression.patch"; - # https://github.com/emsec/hal/pull/596 - url = "https://github.com/emsec/hal/commit/fe1fe74719ab4fef873a22e2b28cce0c57d570e0.patch"; - hash = "sha256-bjbW4pr04pP0TCuSdzPcV8h6LbLWMvdGSf61RL9Ju6E="; - }) - ./4.4.1-newer-spdlog-fmt-compat.patch - ./resynthesis-fix-narrowing-conversion.patch - ]; - # make sure bundled dependencies don't get in the way - install also otherwise # copies them in full to the output, bloating the package postPatch = '' @@ -117,6 +99,7 @@ stdenv.mkDerivation rec { ''; meta = with lib; { + changelog = "https://github.com/emsec/hal/blob/${src.tag}/CHANGELOG.md"; description = "Comprehensive reverse engineering and manipulation framework for gate-level netlists"; mainProgram = "hal"; homepage = "https://github.com/emsec/hal"; diff --git a/pkgs/applications/science/electronics/hal-hardware-analyzer/resynthesis-fix-narrowing-conversion.patch b/pkgs/applications/science/electronics/hal-hardware-analyzer/resynthesis-fix-narrowing-conversion.patch deleted file mode 100644 index 58160330cd06..000000000000 --- a/pkgs/applications/science/electronics/hal-hardware-analyzer/resynthesis-fix-narrowing-conversion.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/plugins/resynthesis/src/resynthesis.cpp b/plugins/resynthesis/src/resynthesis.cpp -index 7a7e404114f..f2889667af8 100644 ---- a/plugins/resynthesis/src/resynthesis.cpp -+++ b/plugins/resynthesis/src/resynthesis.cpp -@@ -1058,7 +1058,7 @@ namespace hal - // delete the created directory and the contained files - std::filesystem::remove_all(base_path); - -- return OK(subgraph.size()); -+ return OK(static_cast(subgraph.size())); - } - - Result resynthesize_subgraph_of_type(Netlist* nl, const std::vector& gate_types, GateLibrary* target_gl) From 21708aaeff6c8b949eb2b51b29f588d1b4724b1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Wed, 24 Sep 2025 03:41:58 -0700 Subject: [PATCH 2/4] hal-hardware-analyzer: move to pkgs/by-name --- .../ha/hal-hardware-analyzer/package.nix} | 13 +++++-------- pkgs/top-level/all-packages.nix | 4 ---- 2 files changed, 5 insertions(+), 12 deletions(-) rename pkgs/{applications/science/electronics/hal-hardware-analyzer/default.nix => by-name/ha/hal-hardware-analyzer/package.nix} (96%) diff --git a/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix b/pkgs/by-name/ha/hal-hardware-analyzer/package.nix similarity index 96% rename from pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix rename to pkgs/by-name/ha/hal-hardware-analyzer/package.nix index 136834c6a294..418ad47d55ad 100644 --- a/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix +++ b/pkgs/by-name/ha/hal-hardware-analyzer/package.nix @@ -11,13 +11,10 @@ nlohmann_json, pkg-config, python3Packages, - qtbase, - qtsvg, - quazip, + libsForQt5, rapidjson, spdlog, verilator, - wrapQtAppsHook, z3, }: @@ -46,11 +43,11 @@ stdenv.mkDerivation rec { cmake ninja pkg-config - wrapQtAppsHook + libsForQt5.wrapQtAppsHook ]; buildInputs = [ - qtbase - qtsvg + libsForQt5.qtbase + libsForQt5.qtsvg boost rapidjson igraph @@ -59,7 +56,7 @@ stdenv.mkDerivation rec { graphviz verilator z3 - quazip + libsForQt5.quazip ] ++ (with python3Packages; [ python diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 43851adceefb..b4f7958530f1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3086,10 +3086,6 @@ with pkgs; haste-client = callPackage ../tools/misc/haste-client { }; - hal-hardware-analyzer = - libsForQt5.callPackage ../applications/science/electronics/hal-hardware-analyzer - { }; - halide = callPackage ../development/compilers/halide { llvmPackages = llvmPackages_19; }; From 06be23d66287c004cb8ef933a9ff6589276ab104 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Fri, 26 Sep 2025 03:24:43 -0700 Subject: [PATCH 3/4] verilator: fix build on Darwin --- pkgs/by-name/ve/verilator/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/ve/verilator/package.nix b/pkgs/by-name/ve/verilator/package.nix index ef657ead72a5..2ea13942aee8 100644 --- a/pkgs/by-name/ve/verilator/package.nix +++ b/pkgs/by-name/ve/verilator/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, perl, flex, bison, @@ -32,6 +33,14 @@ stdenv.mkDerivation rec { hash = "sha256-S+cDnKOTPjLw+sNmWL3+Ay6+UM8poMadkyPSGd3hgnc="; }; + patches = [ + (fetchpatch { + name = "clang-V3hash-overload-fix.patch"; + url = "https://github.com/verilator/verilator/commit/2aa260a03b67d3fe86bc64b8a59183f8dc21e117.patch"; + hash = "sha256-waUsctWiAMG3lCpQi+VUUZ7qMw/kJGu/wNXPHZGuAoU="; + }) + ]; + enableParallelBuilding = true; buildInputs = [ perl From 5af281aba71d7ed32a4d3500347a00379f5e2e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 29 Sep 2025 05:53:09 -0700 Subject: [PATCH 4/4] hal-hardware-analyzer: add passthru.updateScript --- pkgs/by-name/ha/hal-hardware-analyzer/package.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/by-name/ha/hal-hardware-analyzer/package.nix b/pkgs/by-name/ha/hal-hardware-analyzer/package.nix index 418ad47d55ad..081e0b6db4e4 100644 --- a/pkgs/by-name/ha/hal-hardware-analyzer/package.nix +++ b/pkgs/by-name/ha/hal-hardware-analyzer/package.nix @@ -16,6 +16,7 @@ spdlog, verilator, z3, + nix-update-script, }: stdenv.mkDerivation rec { @@ -95,6 +96,8 @@ stdenv.mkDerivation rec { done ''; + passthru.updateScript = nix-update-script { }; + meta = with lib; { changelog = "https://github.com/emsec/hal/blob/${src.tag}/CHANGELOG.md"; description = "Comprehensive reverse engineering and manipulation framework for gate-level netlists";