about summary refs log tree commit diff
path: root/pkgs/development/python-modules/conda/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/conda/default.nix')
-rw-r--r--pkgs/development/python-modules/conda/default.nix91
1 files changed, 68 insertions, 23 deletions
diff --git a/pkgs/development/python-modules/conda/default.nix b/pkgs/development/python-modules/conda/default.nix
index e6dbe10914e7c..adebce0b23771 100644
--- a/pkgs/development/python-modules/conda/default.nix
+++ b/pkgs/development/python-modules/conda/default.nix
@@ -1,38 +1,83 @@
-{ lib
-, buildPythonPackage
-, pythonAtLeast
-, fetchPypi
-, pycosat
-, requests
-, ruamel-yaml
-, isPy3k
-, enum34
+{
+  lib,
+  buildPythonPackage,
+  pythonRelaxDepsHook,
+  hostPlatform,
+  fetchFromGitHub,
+  # build dependencies
+  hatchling,
+  hatch-vcs,
+  # runtime dependencies
+  archspec,
+  conda-libmamba-solver,
+  conda-package-handling,
+  distro,
+  jsonpatch,
+  packaging,
+  platformdirs,
+  pluggy,
+  pycosat,
+  requests,
+  ruamel-yaml,
+  tqdm,
+  truststore,
+  # runtime options
+  defaultEnvPath ? "~/.conda/envs", # default path to store conda environments
+  defaultPkgPath ? "~/.conda/pkgs", # default path to store download conda packages
 }:
-
-# Note: this installs conda as a library. The application cannot be used.
-# This is likely therefore NOT what you're looking for.
-
 buildPythonPackage rec {
   pname = "conda";
-  version = "4.3.16";
-  format = "setuptools";
+  version = "24.4.0";
+  pyproject = true;
 
-  # this is a very outdated version of conda that isn't compatible with python 3.10+
-  disabled = pythonAtLeast "3.10";
-
-  src = fetchPypi {
+  src = fetchFromGitHub {
     inherit pname version;
-    sha256 = "a91ef821343dea3ba9670f3d10b36c1ace4f4c36d70c175d8fc8886e94285953";
+    owner = "conda";
+    repo = "conda";
+    rev = "refs/tags/${version}";
+    hash = "sha256-LdoBlR5EFYd2mQIjOgp1MH3w6osfRfurPq+N5Y1iaFw=";
   };
 
-  propagatedBuildInputs = [ pycosat requests ruamel-yaml ] ++ lib.optional (!isPy3k) enum34;
+  nativeBuildInputs = [ pythonRelaxDepsHook ];
+
+  build-system = [
+    hatchling
+    hatch-vcs
+  ];
+
+  dependencies = [
+    archspec
+    conda-libmamba-solver
+    conda-package-handling
+    distro
+    jsonpatch
+    packaging
+    platformdirs
+    pluggy
+    pycosat
+    requests
+    ruamel-yaml
+    tqdm
+    truststore
+  ];
+
+  patches = [ ./0001-conda_exe.patch ];
+
+  makeWrapperArgs = [
+    "--set CONDA_EXE ${placeholder "out"}/bin/conda"
+    ''--set-default CONDA_ENVS_PATH "${defaultEnvPath}"''
+    ''--set-default CONDA_PKGS_DIRS "${defaultPkgPath}"''
+  ];
+
+  pythonImportsCheck = [ "conda" ];
 
-  # No tests
-  doCheck = false;
+  # menuinst is currently not packaged
+  pythonRemoveDeps = lib.optionals (!hostPlatform.isWindows) [ "menuinst" ];
 
   meta = {
     description = "OS-agnostic, system-level binary package manager";
     homepage = "https://github.com/conda/conda";
     license = lib.licenses.bsd3;
+    maintainers = [ lib.maintainers.ericthemagician ];
   };
 }