about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/electronics/verilator/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/science/electronics/verilator/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix b/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix
new file mode 100644
index 000000000000..8d0fef289104
--- /dev/null
+++ b/nixpkgs/pkgs/applications/science/electronics/verilator/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchFromGitHub, perl, flex, bison, python3, autoconf,
+  which, cmake, ccache, help2man, makeWrapper, glibcLocales,
+  systemc, git, numactl }:
+
+stdenv.mkDerivation rec {
+  pname = "verilator";
+  version = "5.020";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "v${version}";
+    hash = "sha256-7kxH/RPM+fjDuybwJgTYm0X6wpaqesGfu57plrExd8c=";
+  };
+
+  enableParallelBuilding = true;
+  buildInputs = [ perl python3 systemc ];  # ccache
+  nativeBuildInputs = [ makeWrapper flex bison autoconf help2man git ];
+  nativeCheckInputs = [ which numactl ];  # cmake
+
+  doCheck = stdenv.isLinux; # darwin tests are broken for now...
+  checkTarget = "test";
+
+  preConfigure = "autoconf";
+
+  postPatch = ''
+    patchShebangs bin/* src/* nodist/* docs/bin/* examples/xml_py/* \
+    test_regress/{driver.pl,t/*.{pl,pf}} \
+    ci/* ci/docker/run/* ci/docker/run/hooks/* ci/docker/buildenv/build.sh
+  '';
+  # grep '^#!/' -R . | grep -v /nix/store | less
+  # (in nix-shell after patchPhase)
+
+  postInstall = lib.optionalString stdenv.isLinux ''
+    for x in $(ls $out/bin/verilator*); do
+      wrapProgram "$x" --set LOCALE_ARCHIVE "${glibcLocales}/lib/locale/locale-archive"
+    done
+  '';
+
+  meta = with lib; {
+    description = "Fast and robust (System)Verilog simulator/compiler and linter";
+    homepage    = "https://www.veripool.org/verilator";
+    license     = with licenses; [ lgpl3Only artistic2 ];
+    platforms   = platforms.unix;
+    maintainers = with maintainers; [ thoughtpolice amiloradovsky ];
+  };
+}