Shell prompt for 'nix develop'

I’m new to Nix and I’m learning the experimental CLI. I’ve been told the new pattern for creating development environments is to use the shell resulting from ‘nix develop’.

It looks like this forces me to use a bash shell, with a prompt defined in nix.conf (nix.conf - Nix Reference Manual).

Is there any way to use a different shell? Or to configure the shell with a .bashrc? I’m currently using zsh and enjoy my custom prompt.

If not, is there another pattern for starting a development environment that might suit me better?

1 Like

I use GitHub - nix-community/nix-direnv: A fast, persistent use_nix/use_flake implementation for direnv [maintainer=@Mic92 / @bbenne10] for that, it integrates well with ZSH.

3 Likes

@manveru does it change the prompt for you?

i can not visually distinguish from a devshell and my normal zsh prompt…

It sets some envvars which you can use in your prompt. I’ve personally used starship.rs as I got a bit lazy to manage those envvars and shell prompt manually.

nix-direnv is a good choice for non-bash.
You could try to load bash script nix print-dev-env

I use GitHub - MercuryTechnologies/nix-your-shell: A `nix` and `nix-shell` wrapper for shells other than `bash` for this

1 Like

I just use

nix develop -c <command>

More information here nix develop - Nix Reference Manual