How to create a anaconda package?

Hi, all.

I’m new to nix. And I’m trying to figure out how to create a anaconda package.
Here is my script miniconda.nix. And I call this with callPackage ./miniconda.nix { }.

{ stdenv, fetchurl, libselinux, libarchive, libGL, xorg
# Conda installs its packages and environments under this directory
, installationPath ? "/home/ztlevi/.miniconda3"
  # Conda manages most pkgs itself, but expects a few to be on the system.
, condaDeps ? [
# Any extra nixpkgs you'd like available in the FHS env for Conda to use
, extraPkgs ? [ ] }:

stdenv.mkDerivation rec {
  pname = "miniconda";
  version = "4.6.14";

  src = fetchurl {
    url =
    sha256 = "1gn43z1y5zw4yv93q1qajwbmmqs83wx5ls5x4i4llaciba4j6sqd";

  # propagatedUserEnvPkgs = builtins.concatLists [ condaDeps extraPkgs ];

  phases = [ "installPhase" ]; # Removes all phases except installPhase

  installPhase = ''
    mkdir -p $out/bin
    cp ${src} $out/bin/
    chmod +x $out/bin/

    $out/bin/ -p ${installationPath} -b

  outputHashAlgo = "sha256";
  outputHashMode = "recursive";
  outputHash = "0khhp11j395xa9z3hwgrzncg2w75sm8kfn5y85zj6hrhmnpnyz6h";

  meta = with stdenv.lib; {
    description = "Miniconda";
    homepage = "";
    license = licenses.gpl3;
    platforms = platforms.all;
    maintainers = [ ];

But things are not going right. How can I fix this script?

’nix search conda’ reveals that conda is already available from nixpkgs.
With ‘nix edit nixpkgs.conda’ you can see how it is done in nixpkgs. It reveals that it uses exactly the same version of miniconda which you are trying to build. At least if you are on channel 20.03.
So no need to package it yourself.

I had to use conda for work recently. One issue is that it’s also opionated about what binaries it can use. using steam-run alongside conda might work, but not sure if I tried that approach. Eventually I just used a VM with ubuntu to do what i needed, was much easier than reverse engineering the huge number of assumptions conda makes about your environment.

Yes, Thanks for the reply.

I’m aware of that one. The tricky thing is I need to use conda-shell to open a conda environment in order to use it. But then most tools like vscode, pycharm don’t have the write permission to the conda packages directories. And things are broken…

I would prefer to keep it as a package rather something like conda-shell

conda-shell should probably be changed to use buildFHSUserEnv, so that it’s free to play in it’s own isolated sandbox