1{
2 lib,
3 python,
4 buildPythonPackage,
5 cmake,
6 ninja,
7 libmamba,
8 pybind11,
9 setuptools,
10 scikit-build,
11 fmt,
12 spdlog,
13 tl-expected,
14 nlohmann_json,
15 yaml-cpp,
16 reproc,
17 libsolv,
18 curl,
19 zstd,
20 bzip2,
21 wheel,
22}:
23
24buildPythonPackage {
25 pname = "libmambapy";
26 pyproject = true;
27
28 inherit (libmamba) version src;
29
30 nativeBuildInputs = [
31 cmake
32 ninja
33 ];
34
35 env = {
36 NIX_CFLAGS_COMPILE = toString [
37 "-Wno-error=deprecated-declarations"
38 ];
39 };
40
41 buildInputs = [
42 (libmamba.override { python3 = python; })
43 curl
44 zstd
45 bzip2
46 spdlog
47 fmt
48 tl-expected
49 nlohmann_json
50 yaml-cpp
51 reproc
52 libsolv
53 ];
54
55 dependencies = [
56 scikit-build
57 pybind11
58 ];
59
60 build-system = [
61 setuptools
62 wheel
63 ];
64
65 # patch needed to fix setuptools errors
66 # see these for reference
67 # https://stackoverflow.com/questions/72294299/multiple-top-level-packages-discovered-in-a-flat-layout
68 # https://github.com/pypa/setuptools/issues/3197#issuecomment-1078770109
69 postPatch = ''
70 substituteInPlace libmambapy/setup.py --replace-warn "setuptools.setup()" "setuptools.setup(py_modules=[])"
71 '';
72
73 cmakeFlags = [
74 "-GNinja"
75 (lib.cmakeBool "BUILD_LIBMAMBAPY" true)
76 ];
77
78 buildPhase = ''
79 ninjaBuildPhase
80 cp -r libmambapy ../libmambapy
81 cd ../libmambapy
82 pypaBuildPhase
83 '';
84
85 pythonImportsCheck = [
86 "libmambapy"
87 "libmambapy.bindings"
88 ];
89
90 meta = {
91 description = "Python library for the fast Cross-Platform Package Manager";
92 homepage = "https://github.com/mamba-org/mamba";
93 license = lib.licenses.bsd3;
94 maintainers = [ lib.maintainers.ericthemagician ];
95 };
96}