aboutsummaryrefslogtreecommitdiff
path: root/conda.nix
blob: daffc8e6f39815d1c8ba2d7175040eb0a1727c38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ stdenv, lib, writeScript, conda }:

{
  buildCondaEnv = { depends ? [], run }: stdenv.mkDerivation {
    name = "conda-env";
    buildInputs = [ conda ] ++ depends;
    buildCommand = ''
      mkdir $out
      HOME=$out
      conda-shell-4.3.31 << EOF
      conda-install
      ${run}
      EOF
    '';
  };

  withCondaEnv = env: run: stdenv.mkDerivation {
    name = "with-conda-env";
    buildCommand = ''
      #!${stdenv.shell}
      export HOME=${env}
      ${conda}/bin/conda-shell-4.3.31 << EOF
      ${run}
      EOF
    '';
  };
}