blob: b9bf868d13b10f7bf62eb46996fa4267dcc3a74e (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
{
lib,
buildPythonPackage,
flax,
tomlq,
python,
# build-system
nanobind,
ninja,
scikit-build-core,
# nativeBuildInputs
cmake,
pkg-config,
}:
buildPythonPackage rec {
pname = "flaxlib";
version = "0.0.1";
pyproject = true;
inherit (flax) src;
sourceRoot = "${src.name}/flaxlib_src";
postPatch = ''
expected_version="$version"
actual_version=$(${lib.getExe tomlq} --raw --file pyproject.toml "project.version")
if [ "$actual_version" != "$expected_version" ]; then
echo -e "\n\tERROR:"
echo -e "\tThe version of the flaxlib python package ($expected_version) does not match the one in its pyproject.toml file ($actual_version)"
echo -e "\tPlease update the version attribute of the nix python3Packages.flaxlib package."
exit 1
fi
'';
dontUseCmakeConfigure = true;
build-system = [
nanobind
ninja
scikit-build-core
];
nativeBuildInputs = [
cmake
pkg-config
];
env.CMAKE_PREFIX_PATH = "${nanobind}/${python.sitePackages}/nanobind";
pythonImportsCheck = [ "flaxlib" ];
# This package does not have tests (yet ?)
doCheck = false;
passthru = {
inherit (flax) updateScript;
};
meta = {
description = "Rust library used internally by flax";
homepage = "https://github.com/google/flax/tree/main/flaxlib";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
|