From 4300d7707aa88b01f47cc562b776547b6393a91e Mon Sep 17 00:00:00 2001 From: ngc7331 Date: Fri, 3 Apr 2026 18:25:23 +0800 Subject: [PATCH] feat: use jemalloc for verilator Signed-off-by: ngc7331 --- flake.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index dc4457a04..af5f53460 100644 --- a/flake.nix +++ b/flake.nix @@ -47,17 +47,28 @@ }; })) (verilator.overrideAttrs (finalAttrs: previousAttrs: { - version = "5.044"; + version = "5.046"; VERILATOR_SRC_VERSION = "v${finalAttrs.version}"; src = fetchFromGitHub { owner = "verilator"; repo = "verilator"; rev = "v${finalAttrs.version}"; - hash = "sha256-z3jYNzhnZ+OocDAbmsRBWHNNPXLLvExKK1TLDi9JzPQ="; + hash = "sha256-dfZzbQrw/14dFvWnkmCDElwsGm6GdFstNAURujvEIb8="; }; # drop patch https://github.com/NixOS/nixpkgs/commit/06be23d66287c004cb8ef933a9ff6589276ab104 # since it's already included in 5.044 - patches = []; + # and add patch https://github.com/verilator/verilator/commit/bb5a9dc247b3fc07a4e465601243a8c3655eeaff to use jemalloc + patches = [ + (fetchpatch { + name = "Support-jemalloc-as-the-default-allocator-on-Linux.patch"; + url = "https://github.com/verilator/verilator/commit/bb5a9dc247b3fc07a4e465601243a8c3655eeaff.patch"; + hash = "sha256-5rVXPItwsP1Ok9rrLUCyLNlZB0S8UXsR74IxZXua1Y0="; + }) + ]; + # use jemalloc by default + buildInputs = previousAttrs.buildInputs ++ [ + jemalloc + ]; doCheck = false; })) gsim.packages.${system}.default