Reputation: 4041
I want to have a simple indicator showing in my (zsh / oh-my-zsh) shell, that I am one level into a nix shell
or nix develop
environment / sub shell without modifying all my flake.nix
or shell.nix
:
user@hostname ~ nix shell nixpkgs#git
...
#2 user@hostname ~
Upvotes: 0
Views: 34
Reputation: 4041
In my Nix Home Manager configuration I added some custom script lines which enhance the generated .zshrc
to add the script level:
programs.zsh = {
enable = true;
...
initExtra =
''
if [[ $SHLVL -gt 1 ]]; then
PROMPT="#''${SHLVL}''${PROMPT}"
fi
''
};
or with a simple Unicode symbol:
programs.zsh = {
enable = true;
...
initExtra =
''
if [[ $SHLVL -gt 1 ]]; then
case $SHLVL in
2) PROMPT="⁚''${PROMPT}" ;;
3) PROMPT="⁖''${PROMPT}" ;;
4) PROMPT="⁘''${PROMPT}" ;;
*) PROMPT="⁙''${SHLVL}''${PROMPT}" ;;
esac
fi
''
};
Upvotes: 0