summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/root/default.nix
blob: 4a8c7e4873424c86471893e33f36427284ff463e (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
{
  buildPythonPackage,
  python,
  root,
}:

let
  unwrapped = root.override { python3 = python; };
in
buildPythonPackage {
  # ROOT builds the C++ libraries and CPython extensions in one package and
  # python versions must never be mixed
  passthru = {
    inherit unwrapped;
  };

  inherit (unwrapped) pname version meta;

  src = null;

  pyproject = false; # disables setuptools/pyproject logic

  dontUnpack = true;
  dontConfigure = true;
  dontBuild = true;

  installPhase = ''
    mkdir -p $out/${python.sitePackages}
    rmdir $out/${python.sitePackages}
    ln -s ${unwrapped}/lib $out/${python.sitePackages}
  '';

  # Those namespaces are looked up dynamically via ROOTs CPython extension, so
  # these checks cover the most fragile parts of the package
  pythonImportsCheck = [
    "ROOT"
    "ROOT.Experimental"
    "ROOT.Math"
    "ROOT.RooFit"
    "ROOT.std"
  ];
}