Need help for my 1st nix-build

I try my first nix-build, normally very simple because this is just to execute an installation script:

with import <nixpkgs> {};

stdenv.mkDerivation rec {
    pname = "anaconda2";
    version = "2019.10";
    name = "${pname}-${version}";

    src = fetchurl {
      url = "https://repo.anaconda.com/archive/Anaconda2-2019.10-Linux-x86_64.sh";
      sha256 = "0bydx0kf31p5s2rw357vxvs048850hcfrs12x0ccrn575pm7sblb";
    };

    # unpackPhase = "true";
    # doCheck = false;
    dontPatchELF = true;
    phases = "installPhase";

    installPhase = ''
        ${stdenv.shell} $src -b -p $out
   '';

    meta = with pkgs.stdenv.lib; {
      homepage = https://www.anaconda.com;
      description = "Anaconda is a free and open-source[5] distribution of the Python and R programming languages for scientific computing (data science, machine learning applications, large-scale data processing, predictive analytics, etc.), that aims to simplify package management and deployment.";
      license = licenses.bsd3;
    };
}
$ nix-build -v anaconda.nix
...
these derivations will be built:
  /nix/store/vkh6q9dxdwjy5jj31rj74d075s7vanyf-anaconda2-2019.10.drv
building '/nix/store/vkh6q9dxdwjy5jj31rj74d075s7vanyf-anaconda2-2019.10.drv'...
installing
/nix/store/z4ajipns0l1s8b2lrgpy6nng4cys7h99-bash-4.4-p23/bin/bash
PREFIX=/nix/store/x5g6y4rn9gwhy1k06jxpsh53c3sk9v27-anaconda2-2019.10
Unpacking payload ...
/nix/store/vw5q1kz83z3z2y3bavvnymdlgjsxlrx3-Anaconda2-2019.10-Linux-x86_64.sh: line 358: /nix/store/x5g6y4rn9gwhy1k06jxpsh53c3sk9v27-anaconda2-2019.10/conda.exe: No such file or directory
/nix/store/vw5q1kz83z3z2y3bavvnymdlgjsxlrx3-Anaconda2-2019.10-Linux-x86_64.sh: line 360: /nix/store/x5g6y4rn9gwhy1k06jxpsh53c3sk9v27-anaconda2-2019.10/conda.exe: No such file or directory
builder for '/nix/store/vkh6q9dxdwjy5jj31rj74d075s7vanyf-anaconda2-2019.10.drv' failed with exit code 1
error: build of '/nix/store/vkh6q9dxdwjy5jj31rj74d075s7vanyf-anaconda2-2019.10.drv' failed
$ ls -l /nix/store/x5g6y4rn9gwhy1k06jxpsh53c3sk9v27-anaconda2-2019.10/
total 9912
drwxr-xr-x   2 gigi gigi    4096 avril 14 17:15 ./
drwxrwxr-x 768 gigi gigi  442368 avril 14 17:15 ../
-rwxr-xr-x   1 gigi gigi 9695528 avril 14 17:15 conda.exe*

What’s wrong ?

If I execute manually the installer script, it works.

Note if you want to just use conda, see the conda package in Nixpkgs. It is a bit older version though and it packages miniconda.

Writing a Nix expression for a functioning Anaconda is not what I recommend as a first Nix expression :slight_smile:

1 Like

Agreed, the problem with conda is that it will distribute python packages (similar to pip), but also some binaries, which is a problem, as they wont work in a normal nix env.

Conda and NixOS binary opinions differ greatly.

Thank you for your replies :slight_smile:

I will install manually.