Set and activate default conda environment

Using conda-shell installed via

environment.systemPackages = with pkgs; [

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.

Looking at and Nixpkgs 23.11 manual | Nix & NixOS I think I need to set the runScript attribute to something like bash -c "conda activate $env" in an overlay. Am I on the right track here?

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

Hope this is useful for someone!