summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/nn/nnpdf/package.nix
blob: ace23e580293516e74e20033d390064bc4ec0d34 (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
61
62
63
64
65
66
67
68
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  pkg-config,
  apfel,
  gsl,
  lhapdf,
  libarchive,
  yaml-cpp,
  python3,
  sqlite,
  swig,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "nnpdf";
  version = "4.0.9";

  src = fetchFromGitHub {
    owner = "NNPDF";
    repo = "nnpdf";
    rev = finalAttrs.version;
    hash = "sha256-PyhkHlOlzKfDxUX91NkeZWjdEzFR4PW0Yh5Yz6ZA27g=";
  };

  postPatch = ''
    for file in CMakeLists.txt buildmaster/CMakeLists.txt; do
      substituteInPlace $file \
        --replace "-march=nocona -mtune=haswell" ""
    done

    substituteInPlace CMakeLists.txt \
      --replace-fail "cmake_minimum_required (VERSION 3.0.2)" "cmake_minimum_required(VERSION 3.10)"
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    apfel
    gsl
    lhapdf
    libarchive
    yaml-cpp
    python3
    python3.pkgs.numpy
    sqlite
    swig
  ];

  cmakeFlags = [
    "-DCOMPILE_filter=ON"
    "-DCOMPILE_evolvefit=ON"
  ];

  meta = {
    description = "Open-source machine learning framework for global analyses of parton distributions";
    mainProgram = "evolven3fit";
    homepage = "https://docs.nnpdf.science/";
    license = lib.licenses.gpl3Only;
    maintainers = [ lib.maintainers.veprbl ];
    platforms = lib.platforms.unix;
  };
})