Flake - change shell P1 prefix per devShell name

Hi!

I just started writing my first flake.nix and I learned about the devShells outputs (not sure if thats the correct term) and that we can have more then one.

That triggered the idea of having one for the week and other for the weekend:

devShells.x86_64-linux.week = # ...
devShells.x86_64-linux.weekend = # ...

So far the commands are working fine:

nix develop .#week
nix develop .#weekend

But I’m missing a visual queue on which shell is currently activated like: week [h3rmit-cr4b-82@nixos:~/flakes]$ or weekend [h3rmit-cr4b-82@nixos:~/flakes]$.

I read something about existence of bash-prompt-prefix but so far I could not figure out how (or if it is even possible) to use such attribute (?) to create some sort of hook to inject a prefix on the shell.

Is it possible to achieve that? If so how?

Thank you so much for reading :slight_smile:

I am not sure I understand what you mean but in the declaration of each devshell you can set a name. That name is then in the env var $name when you are in the devshell