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 = "1.5.7";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "mamba-org";
30 repo = "mamba";
31 rev = "${pname}-${version}";
32 hash = "sha256-HfmvLi9IBWlaGAn2Ej4Bnm4b3l19jEXwNl5IUkdVxi0=";
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 pythonRemoveDeps = [ "scikit-build" ];
81
82 pythonImportsCheck = [
83 "libmambapy"
84 "libmambapy.bindings"
85 ];
86
87 meta = {
88 description = "The python library for the fast Cross-Platform Package Manager";
89 homepage = "https://github.com/mamba-org/mamba";
90 license = lib.licenses.bsd3;
91 maintainers = [ lib.maintainers.ericthemagician ];
92 };
93}