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 cmakeFlags = cmakeFlags ++ [
40 (lib.cmakeBool "UNITS_BUILD_PYTHON_LIBRARY" true)
41 ];
42
43 # Also upstream turns off testing for the python build so it seems, see:
44 # https://github.com/LLNL/units/blob/v0.13.1/pyproject.toml#L65-L66 However
45 # they do seem to use pytest for their CI, but in our case it fails due to
46 # missing googletest Python modules, which we don't know how to build.
47 doCheck = false;
48 passthru = {
49 top-level = units-llnl;
50 };
51}