nixpkgs/pkgs/by-name/fa/fastnlo-toolkit/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

106 lines
2.7 KiB
Nix

{
lib,
stdenv,
fetchurl,
boost,
gfortran,
lhapdf,
ncurses,
perl,
python ? null,
swig,
yoda,
zlib,
withPython ? false,
}:
stdenv.mkDerivation rec {
pname = "fastnlo-toolkit";
version = "2.5.0-2826";
src = fetchurl {
url = "https://fastnlo.hepforge.org/code/v25/fastnlo_toolkit-${version}.tar.gz";
hash = "sha256-7aIMYCOkHC/17CHYiEfrxvtSJxTDivrS7BQ32cGiEy0=";
};
postPatch = ''
substituteInPlace py-compile \
--replace-fail "import sys, os, py_compile, imp" "import sys, os, py_compile, importlib" \
--replace-fail "imp." "importlib." \
--replace-fail "hasattr(imp" "hasattr(importlib"
'';
patches = [
# Compatibility with YODA 2.x
./yoda2_support.patch
];
buildInputs =
[
boost
gfortran
gfortran.cc.lib
lhapdf
yoda
]
++ lib.optional withPython python
++ lib.optional (withPython && python.isPy3k) ncurses;
propagatedBuildInputs =
[
zlib
]
++ lib.optional withPython [
swig
python.pkgs.distutils
];
preConfigure = ''
substituteInPlace ./fastnlotoolkit/Makefile.in \
--replace "-fext-numeric-literals" ""
# disable test that fails due to strict floating-point number comparison
echo "#!/usr/bin/env perl" > check/fnlo-tk-stattest.pl.in
chmod +x check/fnlo-tk-stattest.pl.in
'';
configureFlags = [
"--with-yoda=${yoda}"
] ++ lib.optional withPython "--enable-pyext";
enableParallelBuilding = true;
doCheck = true;
nativeCheckInputs = [
perl
lhapdf.pdf_sets.CT10nlo
];
preCheck = ''
patchShebangs --build check
'';
enableParallelChecking = false;
# None of our currently packaged versions of swig are C++17-friendly
# Use a workaround from https://github.com/swig/swig/issues/1538
env.CXXFLAGS = "-D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES";
meta = with lib; {
homepage = "http://fastnlo.hepforge.org";
description = "Fast pQCD calculations for hadron-induced processes";
longDescription = ''
The fastNLO project provides computer code to create and evaluate fast
interpolation tables of pre-computed coefficients in perturbation theory
for observables in hadron-induced processes.
This allows fast theory predictions of these observables for arbitrary
parton distribution functions (of regular shape), renormalization or
factorization scale choices, and/or values of alpha_s(Mz) as e.g. needed
in PDF fits or in systematic studies. Very time consuming complete
recalculations are thus avoided.
'';
license = licenses.gpl3Plus;
maintainers = with maintainers; [ veprbl ];
platforms = platforms.unix;
};
}