Merge pull request #296461 from EricTheMagician/conda

authored by Sandro and committed by GitHub c0ae7ef4 a8ec32f7

+395 -24
+60
pkgs/by-name/li/libmamba/package.nix
··· 1 + { 2 + fetchFromGitHub, 3 + lib, 4 + stdenv, 5 + cmake, 6 + fmt, 7 + spdlog, 8 + tl-expected, 9 + nlohmann_json, 10 + yaml-cpp, 11 + simdjson, 12 + reproc, 13 + libsolv, 14 + curl, 15 + libarchive, 16 + zstd, 17 + bzip2, 18 + python3Packages, 19 + }: 20 + stdenv.mkDerivation rec { 21 + pname = "libmamba"; 22 + version = "1.5.7"; 23 + src = fetchFromGitHub { 24 + owner = "mamba-org"; 25 + repo = "mamba"; 26 + rev = "${pname}-${version}"; 27 + hash = "sha256-HfmvLi9IBWlaGAn2Ej4Bnm4b3l19jEXwNl5IUkdVxi0="; 28 + }; 29 + nativeBuildInputs = [ 30 + cmake 31 + python3Packages.python 32 + ]; 33 + buildInputs = [ 34 + fmt 35 + spdlog 36 + tl-expected 37 + nlohmann_json 38 + yaml-cpp 39 + simdjson 40 + reproc 41 + libsolv 42 + curl 43 + libarchive 44 + zstd 45 + bzip2 46 + ]; 47 + 48 + cmakeFlags = [ 49 + (lib.cmakeBool "BUILD_LIBMAMBA" true) 50 + (lib.cmakeBool "BUILD_SHARED" true) 51 + ]; 52 + 53 + meta = { 54 + description = "The library for the fast Cross-Platform Package Manager"; 55 + homepage = "https://github.com/mamba-org/mamba"; 56 + license = lib.licenses.bsd3; 57 + platforms = lib.platforms.all; 58 + maintainers = [ lib.maintainers.ericthemagician ]; 59 + }; 60 + }
+3 -1
pkgs/development/libraries/libsolv/default.nix
··· 13 13 , withRpm ? !stdenv.isDarwin 14 14 , rpm 15 15 , db 16 + , withConda ? true 16 17 }: 17 18 18 19 stdenv.mkDerivation rec { ··· 23 24 owner = "openSUSE"; 24 25 repo = "libsolv"; 25 26 rev = version; 26 - sha256 = "sha256-cL7SDwCzXM2qJQfiu/3nfAiFbcFNn1YXD23Sl3n9nzY="; 27 + hash = "sha256-cL7SDwCzXM2qJQfiu/3nfAiFbcFNn1YXD23Sl3n9nzY="; 27 28 }; 28 29 29 30 cmakeFlags = [ 30 31 "-DENABLE_COMPLEX_DEPS=true" 32 + (lib.cmakeBool "ENABLE_CONDA" withConda) 31 33 "-DENABLE_LZMA_COMPRESSION=true" 32 34 "-DENABLE_BZIP2_COMPRESSION=true" 33 35 "-DENABLE_ZSTD_COMPRESSION=true"
+47
pkgs/development/python-modules/conda-libmamba-solver/default.nix
··· 1 + { 2 + lib, 3 + buildPythonPackage, 4 + pythonRelaxDepsHook, 5 + fetchFromGitHub, 6 + libmambapy, 7 + hatchling, 8 + hatch-vcs, 9 + boltons, 10 + }: 11 + buildPythonPackage rec { 12 + pname = "conda-libmamba-solver"; 13 + version = "24.1.0"; 14 + pyproject = true; 15 + 16 + src = fetchFromGitHub { 17 + inherit pname version; 18 + owner = "conda"; 19 + repo = "conda-libmamba-solver"; 20 + rev = version; 21 + hash = "sha256-vsUYrDVNMKHd3mlaAFYCP4uPQ9HxeKsose5O8InaMcE="; 22 + }; 23 + 24 + nativeBuildInputs = [ pythonRelaxDepsHook ]; 25 + 26 + build-system = [ 27 + hatchling 28 + hatch-vcs 29 + ]; 30 + 31 + dependencies = [ 32 + boltons 33 + libmambapy 34 + ]; 35 + 36 + # this package depends on conda for the import to run succesfully, but conda depends on this package to execute. 37 + # pythonImportsCheck = [ "conda_libmamba_solver" ]; 38 + 39 + pythonRemoveDeps = [ "conda" ]; 40 + 41 + meta = { 42 + description = "The libmamba based solver for conda."; 43 + homepage = "https://github.com/conda/conda-libmamba-solver"; 44 + license = lib.licenses.bsd3; 45 + maintainers = [ lib.maintainers.ericthemagician ]; 46 + }; 47 + }
+30
pkgs/development/python-modules/conda-package-handling/default.nix
··· 1 + { 2 + lib, 3 + buildPythonPackage, 4 + fetchFromGitHub, 5 + setuptools, 6 + conda-package-streaming, 7 + }: 8 + buildPythonPackage rec { 9 + pname = "conda-package-handling"; 10 + version = "2.2.0"; 11 + src = fetchFromGitHub { 12 + owner = "conda"; 13 + repo = "conda-package-handling"; 14 + rev = version; 15 + hash = "sha256-WeGfmT6lLwcwhheLBPMFcVMudY+zPsvTuXuOsiEAorQ="; 16 + }; 17 + 18 + pyproject = true; 19 + build-system = [ setuptools ]; 20 + dependencies = [ conda-package-streaming ]; 21 + 22 + pythonImportsCheck = [ "conda_package_handling" ]; 23 + 24 + meta = { 25 + description = "Create and extract conda packages of various formats"; 26 + homepage = "https://github.com/conda/conda-package-handling"; 27 + license = lib.licenses.bsd3; 28 + maintainers = [ lib.maintainers.ericthemagician ]; 29 + }; 30 + }
+35
pkgs/development/python-modules/conda-package-streaming/default.nix
··· 1 + { 2 + lib, 3 + buildPythonPackage, 4 + fetchFromGitHub, 5 + flit-core, 6 + requests, 7 + zstandard, 8 + }: 9 + buildPythonPackage rec { 10 + pname = "conda-package-streaming"; 11 + version = "0.9.0"; 12 + pyproject = true; 13 + 14 + src = fetchFromGitHub { 15 + owner = "conda"; 16 + repo = "conda-package-streaming"; 17 + rev = "v${version}"; 18 + hash = "sha256-UTql2M+9eFDuHOwLYYKJ751wEcOfLJYzfU6+WF8Je2g="; 19 + }; 20 + 21 + build-system = [ flit-core ]; 22 + dependencies = [ 23 + requests 24 + zstandard 25 + ]; 26 + 27 + pythonImportsCheck = [ "conda_package_streaming" ]; 28 + 29 + meta = { 30 + description = "An efficient library to read from new and old format .conda and .tar.bz2 conda packages."; 31 + homepage = "https://github.com/conda/conda-package-streaming"; 32 + license = lib.licenses.bsd3; 33 + maintainers = [ lib.maintainers.ericthemagician ]; 34 + }; 35 + }
+51
pkgs/development/python-modules/conda/0001-conda_exe.patch
··· 1 + --- a/conda/base/context.py 2 + +++ b/conda/base/context.py 3 + @@ -754,7 +754,7 @@ 4 + 5 + @property 6 + def conda_prefix(self): 7 + - return abspath(sys.prefix) 8 + + return expand("~/.conda") 9 + 10 + @property 11 + @deprecated( 12 + @@ -787,28 +787,17 @@ 13 + The vars can refer to each other if necessary since the dict is ordered. 14 + None means unset it. 15 + """ 16 + - if context.dev: 17 + - return { 18 + - "CONDA_EXE": sys.executable, 19 + - # do not confuse with os.path.join, we are joining paths with ; or : delimiters 20 + - "PYTHONPATH": os.pathsep.join( 21 + - (CONDA_SOURCE_ROOT, os.environ.get("PYTHONPATH", "")) 22 + - ), 23 + - "_CE_M": "-m", 24 + - "_CE_CONDA": "conda", 25 + - "CONDA_PYTHON_EXE": sys.executable, 26 + - } 27 + - else: 28 + - bin_dir = "Scripts" if on_win else "bin" 29 + - exe = "conda.exe" if on_win else "conda" 30 + - # I was going to use None to indicate a variable to unset, but that gets tricky with 31 + - # error-on-undefined. 32 + - return { 33 + - "CONDA_EXE": os.path.join(sys.prefix, bin_dir, exe), 34 + - "_CE_M": "", 35 + - "_CE_CONDA": "", 36 + - "CONDA_PYTHON_EXE": sys.executable, 37 + - } 38 + + import sys 39 + + return { 40 + + "CONDA_EXE": sys.executable, 41 + + # do not confuse with os.path.join, we are joining paths with ; or : delimiters 42 + + "PYTHONPATH": os.pathsep.join( 43 + + [CONDA_SOURCE_ROOT, os.environ.get("PYTHONPATH", "")] + [path for path in sys.path if "site-packages" in path] 44 + + ), 45 + + "_CE_M": "-m", 46 + + "_CE_CONDA": "conda", 47 + + "CONDA_PYTHON_EXE": sys.executable, 48 + + } 49 + 50 + @memoizedproperty 51 + def channel_alias(self):
+68 -23
pkgs/development/python-modules/conda/default.nix
··· 1 - { lib 2 - , buildPythonPackage 3 - , pythonAtLeast 4 - , fetchPypi 5 - , pycosat 6 - , requests 7 - , ruamel-yaml 8 - , isPy3k 9 - , enum34 1 + { 2 + lib, 3 + buildPythonPackage, 4 + pythonRelaxDepsHook, 5 + hostPlatform, 6 + fetchFromGitHub, 7 + # build dependencies 8 + hatchling, 9 + hatch-vcs, 10 + # runtime dependencies 11 + archspec, 12 + conda-libmamba-solver, 13 + conda-package-handling, 14 + distro, 15 + jsonpatch, 16 + packaging, 17 + platformdirs, 18 + pluggy, 19 + pycosat, 20 + requests, 21 + ruamel-yaml, 22 + tqdm, 23 + truststore, 24 + # runtime options 25 + defaultEnvPath ? "~/.conda/envs", # default path to store conda environments 26 + defaultPkgPath ? "~/.conda/pkgs", # default path to store download conda packages 10 27 }: 11 - 12 - # Note: this installs conda as a library. The application cannot be used. 13 - # This is likely therefore NOT what you're looking for. 14 - 15 28 buildPythonPackage rec { 16 29 pname = "conda"; 17 - version = "4.3.16"; 18 - format = "setuptools"; 30 + version = "24.1.2"; 31 + pyproject = true; 19 32 20 - # this is a very outdated version of conda that isn't compatible with python 3.10+ 21 - disabled = pythonAtLeast "3.10"; 22 - 23 - src = fetchPypi { 33 + src = fetchFromGitHub { 24 34 inherit pname version; 25 - sha256 = "a91ef821343dea3ba9670f3d10b36c1ace4f4c36d70c175d8fc8886e94285953"; 35 + owner = "conda"; 36 + repo = "conda"; 37 + rev = version; 38 + hash = "sha256-L/Y7Bb3R5YqXbjTN4CRPFnkgymVLrxuFmjVzpvt28dE="; 26 39 }; 27 40 28 - propagatedBuildInputs = [ pycosat requests ruamel-yaml ] ++ lib.optional (!isPy3k) enum34; 41 + nativeBuildInputs = [ pythonRelaxDepsHook ]; 42 + 43 + build-system = [ 44 + hatchling 45 + hatch-vcs 46 + ]; 47 + 48 + dependencies = [ 49 + archspec 50 + conda-libmamba-solver 51 + conda-package-handling 52 + distro 53 + jsonpatch 54 + packaging 55 + platformdirs 56 + pluggy 57 + pycosat 58 + requests 59 + ruamel-yaml 60 + tqdm 61 + truststore 62 + ]; 29 63 30 - # No tests 31 - doCheck = false; 64 + patches = [ ./0001-conda_exe.patch ]; 65 + 66 + makeWrapperArgs = [ 67 + "--set CONDA_EXE ${placeholder "out"}/bin/conda" 68 + ''--set-default CONDA_ENVS_PATH "${defaultEnvPath}"'' 69 + ''--set-default CONDA_PKGS_DIRS "${defaultPkgPath}"'' 70 + ]; 71 + 72 + pythonImportsCheck = [ "conda" ]; 73 + 74 + # menuinst is currently not packaged 75 + pythonRemoveDeps = lib.optionals (!hostPlatform.isWindows) [ "menuinst" ]; 32 76 33 77 meta = { 34 78 description = "OS-agnostic, system-level binary package manager"; 35 79 homepage = "https://github.com/conda/conda"; 36 80 license = lib.licenses.bsd3; 81 + maintainers = [ lib.maintainers.ericthemagician ]; 37 82 }; 38 83 }
+93
pkgs/development/python-modules/libmambapy/default.nix
··· 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 + }: 23 + buildPythonPackage 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 + }
+8
pkgs/top-level/python-packages.nix
··· 2400 2400 2401 2401 conda = callPackage ../development/python-modules/conda { }; 2402 2402 2403 + conda-libmamba-solver = callPackage ../development/python-modules/conda-libmamba-solver { }; 2404 + 2405 + conda-package-handling = callPackage ../development/python-modules/conda-package-handling { }; 2406 + 2407 + conda-package-streaming = callPackage ../development/python-modules/conda-package-streaming { }; 2408 + 2403 2409 confection = callPackage ../development/python-modules/confection { }; 2404 2410 2405 2411 configargparse = callPackage ../development/python-modules/configargparse { }; ··· 6620 6626 liblzfse = callPackage ../development/python-modules/liblzfse { 6621 6627 inherit (pkgs) lzfse; 6622 6628 }; 6629 + 6630 + libmambapy = callPackage ../development/python-modules/libmambapy { }; 6623 6631 6624 6632 libmodulemd = lib.pipe pkgs.libmodulemd [ 6625 6633 toPythonModule