1{
2 lib,
3 fetchFromGitHub,
4 pythonPackages,
5 buildPythonPackage,
6 cmake,
7 ninja,
8 libmamba,
9 pybind11,
10 setuptools,
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}:
23buildPythonPackage rec {
24 pname = "libmambapy";
25 version = "2024.03.25";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "mamba-org";
30 repo = "mamba";
31 rev = "refs/tags/${version}";
32 hash = "sha256-sxZDlMFoMLq2EAzwBVO++xvU1C30JoIoZXEX/sqkXS0=";
33 };
34
35 nativeBuildInputs = [
36 cmake
37 ninja
38 ];
39
40 buildInputs = [
41 (libmamba.override { python3Packages = pythonPackages; })
42 pybind11
43 fmt
44 spdlog
45 tl-expected
46 nlohmann_json
47 yaml-cpp
48 reproc
49 libsolv
50 curl
51 zstd
52 bzip2
53 ];
54
55 build-system = [
56 setuptools
57 wheel
58 ];
59
60 # patch needed to fix setuptools errors
61 # see these for reference
62 # https://stackoverflow.com/questions/72294299/multiple-top-level-packages-discovered-in-a-flat-layout
63 # https://github.com/pypa/setuptools/issues/3197#issuecomment-1078770109
64 postPatch = ''
65 substituteInPlace libmambapy/setup.py --replace-warn "setuptools.setup()" "setuptools.setup(py_modules=[])"
66 '';
67
68 cmakeFlags = [
69 "-GNinja"
70 (lib.cmakeBool "BUILD_LIBMAMBAPY" true)
71 ];
72
73 buildPhase = ''
74 ninjaBuildPhase
75 cp -r libmambapy ../libmambapy
76 cd ../libmambapy
77 pypaBuildPhase
78 '';
79
80
81 pythonImportsCheck = [
82 "libmambapy"
83 "libmambapy.bindings"
84 ];
85
86 meta = {
87 description = "Python library for the fast Cross-Platform Package Manager";
88 homepage = "https://github.com/mamba-org/mamba";
89 license = lib.licenses.bsd3;
90 maintainers = [ lib.maintainers.ericthemagician ];
91 };
92}