nixpkgs/pkgs/by-name/ve/verilator/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

90 lines
1.8 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
perl,
flex,
bison,
python3,
autoconf,
which,
help2man,
makeWrapper,
systemc,
git,
numactl,
coreutils,
}:
stdenv.mkDerivation rec {
pname = "verilator";
version = "5.028";
# Verilator gets the version from this environment variable
# if it can't do git describe while building.
VERILATOR_SRC_VERSION = "v${version}";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
hash = "sha256-YgK60fAYG5575uiWmbCODqNZMbRfFdOVcJXz5h5TLuE=";
};
enableParallelBuilding = true;
buildInputs = [
perl
python3
systemc
# ccache
];
nativeBuildInputs = [
makeWrapper
flex
bison
autoconf
help2man
git
];
nativeCheckInputs = [
which
numactl
coreutils
# cmake
];
doCheck = stdenv.hostPlatform.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
# verilator --gdbbt uses /bin/echo to test if gdb works.
sed -i 's|/bin/echo|${coreutils}\/bin\/echo|' bin/verilator
'';
# grep '^#!/' -R . | grep -v /nix/store | less
# (in nix-shell after patchPhase)
env = {
SYSTEMC_INCLUDE = "${lib.getDev systemc}/include";
SYSTEMC_LIBDIR = "${lib.getLib systemc}/lib";
};
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
];
};
}