about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorBenjamin Hipple <bhipple@protonmail.com>2018-02-18 13:21:25 -0500
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2018-02-18 18:21:25 +0000
commit5ab428799ec920022b82d5d4f2c10ebfe0f418c4 (patch)
treeeacf293a5d41ad9811aa6a4871c789539834d101 /pkgs/tools
parentc64639b54caa6595f9ef62ed2548593b5fe5db66 (diff)
downloadnixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.tar
nixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.tar.gz
nixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.tar.bz2
nixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.tar.lz
nixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.tar.xz
nixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.tar.zst
nixlib-5ab428799ec920022b82d5d4f2c10ebfe0f418c4.zip
conda: init at miniconda3 4.3.31 (#34872)
* conda: init at miniconda3 4.3.31
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/package-management/conda/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/tools/package-management/conda/default.nix b/pkgs/tools/package-management/conda/default.nix
new file mode 100644
index 000000000000..4589cfcec880
--- /dev/null
+++ b/pkgs/tools/package-management/conda/default.nix
@@ -0,0 +1,71 @@
+{ lib
+, stdenv
+, fetchurl
+, runCommand
+, makeWrapper
+, buildFHSUserEnv
+, libselinux
+, xorg
+# Conda installs its packages and environments under this directory
+, installationPath ? "~/.conda"
+# Conda manages most pkgs itself, but expects a few to be on the system.
+, condaDeps ? [ stdenv.cc xorg.libSM xorg.libICE xorg.libXrender libselinux ]
+# Any extra nixpkgs you'd like available in the FHS env for Conda to use
+, extraPkgs ? [ ]
+}:
+
+# How to use this package?
+#
+# First-time setup: this nixpkg downloads the conda installer and provides a FHS
+# env in which it can run. On first use, the user will need to install conda to
+# the installPath using the installer:
+# $ nix-env -iA conda
+# $ conda-shell
+# $ conda-install
+#
+# Under normal usage, simply call `conda-shell` to activate the FHS env,
+# and then use conda commands as normal:
+# $ conda-shell
+# $ conda install spyder
+let
+  version = "4.3.31";
+  src = fetchurl {
+      url = "https://repo.continuum.io/miniconda/Miniconda3-${version}-Linux-x86_64.sh";
+      sha256 = "1rklq81s9v7xz1q0ha99w2sl6kyc5vhk6b21cza0jr3b8cgz0lam";
+  };
+
+  conda = runCommand "conda-install" { buildInputs = [ makeWrapper ]; }
+    ''
+      mkdir -p $out/bin
+      cp ${src} $out/bin/miniconda-installer.sh
+      chmod +x $out/bin/miniconda-installer.sh
+
+      makeWrapper                            \
+        $out/bin/miniconda-installer.sh      \
+        $out/bin/conda-install               \
+        --add-flags "-p ${installationPath}" \
+        --add-flags "-b"
+    '';
+in
+  buildFHSUserEnv {
+    name = "conda-shell";
+    targetPkgs = pkgs: (builtins.concatLists [ [ conda ] condaDeps extraPkgs]);
+    profile = ''
+      # Add conda to PATH
+      export PATH=${installationPath}/bin:$PATH
+      # Paths for gcc if compiling some C sources with pip
+      export NIX_CFLAGS_COMPILE="-I${installationPath}/include"
+      export NIX_CFLAGS_LINK="-L${installationPath}lib"
+      # Some other required environment variables
+      export FONTCONFIG_FILE=/etc/fonts/fonts.conf
+      export QTCOMPOSE=${xorg.libX11}/share/X11/locale
+    '';
+
+    meta = {
+      description = "Conda is a package manager for Python";
+      homepage = https://conda.io/;
+      platforms = lib.platforms.linux;
+      license = lib.licenses.bsd3;
+      maintainers = with lib.maintainers; [ jluttine bhipple ];
+    };
+  }