about summary refs log tree commit diff
path: root/pkgs/development/libraries/physics
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2020-03-09 14:37:20 -0400
committerJon <jonringer@users.noreply.github.com>2020-03-24 12:32:55 -0700
commit61bc9e12a4e09307aa986369baa66cc739791e6f (patch)
tree58f0a2e1886827758584691591cd191e5eb028a1 /pkgs/development/libraries/physics
parent1630cdd085fceeca6746e42475d3d271a8b2b986 (diff)
hepmc3: add python support
Diffstat (limited to 'pkgs/development/libraries/physics')
-rw-r--r--pkgs/development/libraries/physics/hepmc3/default.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/pkgs/development/libraries/physics/hepmc3/default.nix b/pkgs/development/libraries/physics/hepmc3/default.nix
index ceb0669d855b8..a07c3c19a1bb6 100644
--- a/pkgs/development/libraries/physics/hepmc3/default.nix
+++ b/pkgs/development/libraries/physics/hepmc3/default.nix
@@ -1,4 +1,9 @@
-{ stdenv, fetchurl, cmake, coreutils, root }:
+{ stdenv, fetchurl, cmake, coreutils, python, root }:
+
+let
+  pythonVersion = with stdenv.lib.versions; "${major python.version}${minor python.version}";
+  withPython = python != null;
+in
 
 stdenv.mkDerivation rec {
   pname = "hepmc3";
@@ -10,10 +15,14 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ cmake ];
-  buildInputs = [ root ];
+  buildInputs = [ root ]
+    ++ stdenv.lib.optional withPython python;
 
   cmakeFlags = [
-    "-DHEPMC3_ENABLE_PYTHON=OFF"
+    "-DHEPMC3_ENABLE_PYTHON=${if withPython then "ON" else "OFF"}"
+  ] ++ stdenv.lib.optionals withPython [
+    "-DHEPMC3_PYTHON_VERSIONS=${if python.isPy3k then "3.X" else "2.X"}"
+    "-DHEPMC3_Python_SITEARCH${pythonVersion}=${placeholder "out"}/${python.sitePackages}"
   ];
 
   postInstall = ''