nixpkgs/pkgs/applications/science/electronics/hal-hardware-analyzer/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

53 lines
1.8 KiB
Nix

{ lib, stdenv, fetchFromGitHub, cmake, ninja, pkgconfig, python3Packages
, boost, rapidjson, qtbase, qtsvg, igraph, spdlog, wrapQtAppsHook
, fmt, graphviz, llvmPackages ? null
}:
stdenv.mkDerivation rec {
version = "3.1.9";
pname = "hal-hardware-analyzer";
src = fetchFromGitHub {
owner = "emsec";
repo = "hal";
rev = "v${version}";
sha256 = "0yvvlx0hq73x20va4csa8kyx3x4z648s6l6qqirzjpmxa1w91xc6";
};
# make sure bundled dependencies don't get in the way - install also otherwise
# copies them in full to the output, bloating the package
postPatch = ''
shopt -s extglob
rm -rf deps/!(sanitizers-cmake)/*
shopt -u extglob
'';
nativeBuildInputs = [ cmake ninja pkgconfig ];
buildInputs = [ qtbase qtsvg boost rapidjson igraph spdlog fmt graphviz wrapQtAppsHook ]
++ (with python3Packages; [ python pybind11 ])
++ stdenv.lib.optional stdenv.cc.isClang llvmPackages.openmp;
cmakeFlags = with stdenv.lib.versions; [
"-DHAL_VERSION_RETURN=${version}"
"-DHAL_VERSION_MAJOR=${major version}"
"-DHAL_VERSION_MINOR=${minor version}"
"-DHAL_VERSION_PATCH=${patch version}"
"-DHAL_VERSION_TWEAK=0"
"-DHAL_VERSION_ADDITIONAL_COMMITS=0"
"-DHAL_VERSION_DIRTY=false"
"-DHAL_VERSION_BROKEN=false"
"-DENABLE_INSTALL_LDCONFIG=off"
"-DBUILD_ALL_PLUGINS=on"
];
# needed for macos build - this is why we use wrapQtAppsHook instead of
# the qt mkDerivation - the latter forcibly overrides this.
cmakeBuildType = "MinSizeRel";
meta = with lib; {
description = "A comprehensive reverse engineering and manipulation framework for gate-level netlists";
homepage = "https://github.com/emsec/hal";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ ris shamilton ];
};
}