Skip to content

Commit

Permalink
fix: set PS1 in nix shells only (#205)
Browse files Browse the repository at this point in the history
- outside of nix shells, e.g. when sourcing the env
  respect the user's env preferences (e.g. starship)
  • Loading branch information
blaggacao authored Jan 11, 2024
1 parent 41108ea commit d45f45b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/devshell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,13 @@ in

# Set a cool PS1
PS1 = stringAfter [ "PS1_util" ] (lib.mkDefault ''
PS1='\[\033[38;5;202m\][${cfg.name}]$(rel_root)\$\[\033[0m\] '
__set_prompt() {
PS1='\[\033[38;5;202m\][${cfg.name}]$(rel_root)\$\[\033[0m\] '
}
# Only set the prompt when entering a nix shell, since nix shells
# always reset to plain bash, otherwise respect the user's preferences
[[ -n "''${IN_NIX_SHELL:-}" ]] && __set_prompt
unset -f __set_prompt
'');
};

Expand Down

0 comments on commit d45f45b

Please sign in to comment.