Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 python3, 6 cmake, 7 ninja, 8}: 9 10let 11 pyEnv = python3.withPackages (ps: [ 12 ps.setuptools 13 ps.tomli 14 ps.pip 15 ps.setuptools 16 ]); 17in 18stdenv.mkDerivation (finalAttrs: { 19 pname = "lief"; 20 version = "0.16.6"; 21 22 src = fetchFromGitHub { 23 owner = "lief-project"; 24 repo = "LIEF"; 25 tag = finalAttrs.version; 26 hash = "sha256-SvwFyhIBuG0u5rE7+1OaO7VZu4/X4jVI6oFOm5+yCd8="; 27 }; 28 29 outputs = [ 30 "out" 31 "py" 32 ]; 33 34 nativeBuildInputs = [ 35 cmake 36 ninja 37 ]; 38 39 # Not in propagatedBuildInputs because only the $py output needs it; $out is 40 # just the library itself (e.g. C/C++ headers). 41 buildInputs = with python3.pkgs; [ 42 python 43 build 44 pathspec 45 pip 46 pydantic 47 scikit-build-core 48 ]; 49 50 cmakeFlags = [ (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic)) ]; 51 52 postBuild = '' 53 pushd ../api/python 54 ${pyEnv.interpreter} -m build --no-isolation --wheel --skip-dependency-check --config-setting=--parallel=$NIX_BUILD_CORES 55 popd 56 ''; 57 58 postInstall = '' 59 pushd ../api/python 60 ${pyEnv.interpreter} -m pip install --prefix $py dist/*.whl 61 popd 62 ''; 63 64 meta = with lib; { 65 description = "Library to Instrument Executable Formats"; 66 homepage = "https://lief.quarkslab.com/"; 67 license = [ licenses.asl20 ]; 68 platforms = with platforms; linux ++ darwin; 69 maintainers = with maintainers; [ 70 lassulus 71 genericnerdyusername 72 ]; 73 }; 74})