aboutsummaryrefslogtreecommitdiff
path: root/conda.nix
blob: bbcb7cf74e575e15812b0a6d1f2dd68bedc94db0 (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";
    propagatedBuildInputs = [ conda ] ++ depends;
    buildCommand = ''
      mkdir $out
      HOME=$out
      conda-shell-4.3.31 << EOF
      conda-install
      ${run}
      EOF
    '';
  };

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