mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 09:36:15 +02:00
Merge pull request #7734 from Sciencentistguy/root-red-ps1
nix-shell: Colour the prompt red if the user is root
This commit is contained in:
commit
cde2e2a404
1 changed files with 3 additions and 1 deletions
|
@ -536,7 +536,9 @@ static void main_nix_build(int argc, char * * argv)
|
||||||
"SHELL=%5%; "
|
"SHELL=%5%; "
|
||||||
"BASH=%5%; "
|
"BASH=%5%; "
|
||||||
"set +e; "
|
"set +e; "
|
||||||
R"s([ -n "$PS1" -a -z "$NIX_SHELL_PRESERVE_PROMPT" ] && PS1='\n\[\033[1;32m\][nix-shell:\w]\$\[\033[0m\] '; )s"
|
R"s([ -n "$PS1" -a -z "$NIX_SHELL_PRESERVE_PROMPT" ] && )s" +
|
||||||
|
(getuid() == 0 ? R"s(PS1='\n\[\033[1;31m\][nix-shell:\w]\$\[\033[0m\] '; )s"
|
||||||
|
: R"s(PS1='\n\[\033[1;32m\][nix-shell:\w]\$\[\033[0m\] '; )s") +
|
||||||
"if [ \"$(type -t runHook)\" = function ]; then runHook shellHook; fi; "
|
"if [ \"$(type -t runHook)\" = function ]; then runHook shellHook; fi; "
|
||||||
"unset NIX_ENFORCE_PURITY; "
|
"unset NIX_ENFORCE_PURITY; "
|
||||||
"shopt -u nullglob; "
|
"shopt -u nullglob; "
|
||||||
|
|
Loading…
Reference in a new issue