1{
2 lib,
3 buildPythonPackage,
4 units-llnl,
5
6 # build-system
7 nanobind,
8 scikit-build-core,
9
10 # nativeBuildInputs
11 cmake,
12 # NOTE that if top-level units-llnl package uses cmakeFlags other then
13 # Nixpkgs' default, the build might fail, and you'd want to pick only the
14 # cmakeFlags that don't cause a failure. See also:
15 # https://github.com/scipp/scipp/issues/3705
16 cmakeFlags ? units-llnl.cmakeFlags,
17 ninja,
18}:
19
20buildPythonPackage {
21 inherit (units-llnl)
22 pname
23 version
24 src
25 meta
26 ;
27 pyproject = true;
28
29 build-system = [
30 nanobind
31 scikit-build-core
32 ];
33
34 nativeBuildInputs = [
35 cmake
36 ninja
37 ];
38 dontUseCmakeConfigure = true;
39 env = {
40 SKBUILD_CMAKE_ARGS = lib.strings.concatStringsSep ";" (
41 cmakeFlags
42 ++ [
43 (lib.cmakeBool "UNITS_BUILD_PYTHON_LIBRARY" true)
44 ]
45 );
46 };
47
48 # Also upstream turns off testing for the python build so it seems, see:
49 # https://github.com/LLNL/units/blob/v0.13.1/pyproject.toml#L65-L66 However
50 # they do seem to use pytest for their CI, but in our case it fails due to
51 # missing googletest Python modules, which we don't know how to build.
52 doCheck = false;
53 passthru = {
54 top-level = units-llnl;
55 };
56}