diff --git a/pkgs/development/python-modules/units-llnl/default.nix b/pkgs/development/python-modules/units-llnl/default.nix new file mode 100644 index 000000000000..03d0cfda1515 --- /dev/null +++ b/pkgs/development/python-modules/units-llnl/default.nix @@ -0,0 +1,56 @@ +{ + lib, + buildPythonPackage, + units-llnl, + + # build-system + nanobind, + scikit-build-core, + + # nativeBuildInputs + cmake, + # NOTE that if top-level units-llnl package uses cmakeFlags other then + # Nixpkgs' default, the build might fail, and you'd want to pick only the + # cmakeFlags that don't cause a failure. See also: + # https://github.com/scipp/scipp/issues/3705 + cmakeFlags ? units-llnl.cmakeFlags, + ninja, +}: + +buildPythonPackage { + inherit (units-llnl) + pname + version + src + meta + ; + pyproject = true; + + build-system = [ + nanobind + scikit-build-core + ]; + + nativeBuildInputs = [ + cmake + ninja + ]; + dontUseCmakeConfigure = true; + env = { + SKBUILD_CMAKE_ARGS = lib.strings.concatStringsSep ";" ( + cmakeFlags + ++ [ + (lib.cmakeBool "UNITS_BUILD_PYTHON_LIBRARY" true) + ] + ); + }; + + # Also upstream turns off testing for the python build so it seems, see: + # https://github.com/LLNL/units/blob/v0.13.1/pyproject.toml#L65-L66 However + # they do seem to use pytest for their CI, but in our case it fails due to + # missing googletest Python modules, which we don't know how to build. + doCheck = false; + passthru = { + top-level = units-llnl; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 35539f3ee485..5d4d3954d3c8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -18748,6 +18748,10 @@ self: super: with self; { unique-log-filter = callPackage ../development/python-modules/unique-log-filter { }; + units-llnl = callPackage ../development/python-modules/units-llnl { + inherit (pkgs) units-llnl; + }; + unittest-data-provider = callPackage ../development/python-modules/unittest-data-provider { }; unittest-xml-reporting = callPackage ../development/python-modules/unittest-xml-reporting { };