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