Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 61 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 bash, 6 python3, 7 makeWrapper, 8}: 9 10stdenv.mkDerivation rec { 11 pname = "lhapdf"; 12 version = "6.5.5"; 13 14 src = fetchurl { 15 url = "https://www.hepforge.org/archive/lhapdf/LHAPDF-${version}.tar.gz"; 16 sha256 = "sha256-ZB1eoJQreeREfhXlozSR/zxwMtcdYYEZk14UrSf146U="; 17 }; 18 19 # The Apple SDK only exports locale_t from xlocale.h whereas glibc 20 # had decided that xlocale.h should be a part of locale.h 21 postPatch = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.cc.isGNU) '' 22 substituteInPlace src/GridPDF.cc --replace '#include <locale>' '#include <xlocale.h>' 23 ''; 24 25 nativeBuildInputs = 26 [ 27 bash 28 makeWrapper 29 ] 30 ++ lib.optionals (python3 != null && lib.versionAtLeast python3.version "3.10") [ 31 python3.pkgs.cython 32 ]; 33 buildInputs = [ python3 ]; 34 35 configureFlags = lib.optionals (python3 == null) [ "--disable-python" ]; 36 37 preBuild = lib.optionalString (python3 != null && lib.versionAtLeast python3.version "3.10") '' 38 rm wrappers/python/lhapdf.cpp 39 ''; 40 41 strictDeps = true; 42 43 enableParallelBuilding = true; 44 45 passthru = { 46 pdf_sets = import ./pdf_sets.nix { inherit lib stdenv fetchurl; }; 47 }; 48 49 postInstall = '' 50 patchShebangs --build $out/bin/lhapdf-config 51 wrapProgram $out/bin/lhapdf --prefix PYTHONPATH : "$(toPythonPath "$out")" 52 ''; 53 54 meta = with lib; { 55 description = "General purpose interpolator, used for evaluating Parton Distribution Functions from discretised data files"; 56 license = licenses.gpl3; 57 homepage = "https://www.lhapdf.org"; 58 platforms = platforms.unix; 59 maintainers = with maintainers; [ veprbl ]; 60 }; 61}