12 # Conda installs its packages and environments under this directory
13 , installationPath ? "~/.conda"
14 # Conda manages most pkgs itself, but expects a few to be on the system.
15 , condaDeps ? [ stdenv.cc xorg.libSM xorg.libICE xorg.libX11 xorg.libXau xorg.libXi xorg.libXrender libselinux libGL zlib]
16 # Any extra nixpkgs you'd like available in the FHS env for Conda to use
20 # How to use this package?
22 # First-time setup: this nixpkg downloads the conda installer and provides a FHS
23 # env in which it can run. On first use, the user will need to install conda to
24 # the installPath using the installer:
29 # Under normal usage, simply call `conda-shell` to activate the FHS env,
30 # and then use conda commands as normal:
32 # $ conda install spyder
36 url = "https://repo.continuum.io/miniconda/Miniconda3-py39_${version}-Linux-x86_64.sh";
37 sha256 = "sha256-TunDqlMynNemO0mHfAurtJsZt+WvKYB7eTp2vbHTYrQ=";
41 libPath = lib.makeLibraryPath [
45 runCommand "conda-install" { nativeBuildInputs = [ makeWrapper ]; buildInputs = [ zlib]; }
46 # on line 10, we have 'unset LD_LIBRARY_PATH'
47 # we have to comment it out however in a way that the number of bytes in the
48 # file does not change. So we replace the 'u' in the line with a '#'
49 # The reason is that the binary payload is encoded as number
50 # of bytes from the top of the installer script
51 # and unsetting the library path prevents the zlib library from being discovered
55 sed 's/unset LD_LIBRARY_PATH/#nset LD_LIBRARY_PATH/' ${src} > $out/bin/miniconda-installer.sh
56 chmod +x $out/bin/miniconda-installer.sh
59 $out/bin/miniconda-installer.sh \
60 $out/bin/conda-install \
61 --add-flags "-p ${installationPath}" \
63 --prefix "LD_LIBRARY_PATH" : "${libPath}"
68 targetPkgs = pkgs: (builtins.concatLists [ [ conda ] condaDeps extraPkgs]);
71 export PATH=${installationPath}/bin:$PATH
72 # Paths for gcc if compiling some C sources with pip
73 export NIX_CFLAGS_COMPILE="-I${installationPath}/include"
74 export NIX_CFLAGS_LINK="-L${installationPath}lib"
75 # Some other required environment variables
76 export FONTCONFIG_FILE=/etc/fonts/fonts.conf
77 export QTCOMPOSE=${xorg.libX11}/share/X11/locale
78 export LIBARCHIVE=${libarchive.lib}/lib/libarchive.so
79 # Allows `conda activate` to work properly
80 source ${installationPath}/etc/profile.d/conda.sh
83 runScript = "bash -l";
86 description = "Conda is a package manager for Python";
87 homepage = "https://conda.io/";
88 platforms = lib.platforms.linux;
89 license = lib.licenses.bsd3;
90 maintainers = with lib.maintainers; [ jluttine bhipple ];