Using conda-shell
installed via
environment.systemPackages = with pkgs; [
...
conda
...
]
how can a user configure and activate a conda environment (other than the base
environment) as the default when calling conda-shell
or have a custom conda-shell-$env
command for that? Since conda-shell uses nix-shell itself, I was not able to just do the shell equivalent ... && conda activate $env
.
I had the same question, and found this thread. Although the thread is fairly old, let me still propose a solution because people googling for this will end here.
Say you want to open a conda environment named test
, and run a command in there (say, python).
You can do:
conda-shell -c "conda activate test && python"
Or you can create a file with the conda-shell
shebang and execute that:
#!/usr/bin/env conda-shell
conda activate test
python
Hope this is useful for someone!
2 Likes