Added environment.promptInit to allow PS1 overriding. Would be nicer to be able to allow overriding via shellInit, however could not get that to work. For now this is a temporary solution which will not break anything.
This commit is contained in:
parent
1a82024dd8
commit
88a9d7a9ca
|
@ -25,9 +25,24 @@ let
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
|
environment.promptInit = mkOption {
|
||||||
|
default = ''
|
||||||
|
# Provide a nice prompt.
|
||||||
|
PROMPT_COLOR="1;31m"
|
||||||
|
let $UID && PROMPT_COLOR="1;32m"
|
||||||
|
PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
|
||||||
|
if test "$TERM" = "xterm"; then
|
||||||
|
PS1="\[\033]2;\h:\u:\w\007\]$PS1"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
description = "
|
||||||
|
Script used to initialized shell prompt.
|
||||||
|
";
|
||||||
|
type = with pkgs.lib.types; string;
|
||||||
|
};
|
||||||
|
|
||||||
environment.shellInit = mkOption {
|
environment.shellInit = mkOption {
|
||||||
default = "";
|
default = "";
|
||||||
example = ''export PATH=/godi/bin/:$PATH'';
|
example = ''export PATH=/godi/bin/:$PATH'';
|
||||||
|
@ -65,6 +80,7 @@ in
|
||||||
# configured properly.
|
# configured properly.
|
||||||
source = pkgs.substituteAll {
|
source = pkgs.substituteAll {
|
||||||
src = ./bashrc.sh;
|
src = ./bashrc.sh;
|
||||||
|
inherit (config.environment) promptInit;
|
||||||
inherit initBashCompletion;
|
inherit initBashCompletion;
|
||||||
};
|
};
|
||||||
target = "bashrc";
|
target = "bashrc";
|
||||||
|
|
|
@ -19,14 +19,7 @@ if [ -z "$PS1" ]; then return; fi
|
||||||
# Check the window size after every command.
|
# Check the window size after every command.
|
||||||
shopt -s checkwinsize
|
shopt -s checkwinsize
|
||||||
|
|
||||||
# Provide a nice prompt.
|
@promptInit@
|
||||||
PROMPT_COLOR="1;31m"
|
|
||||||
let $UID && PROMPT_COLOR="1;32m"
|
|
||||||
PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] "
|
|
||||||
if test "$TERM" = "xterm"; then
|
|
||||||
PS1="\[\033]2;\h:\u:\w\007\]$PS1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
@initBashCompletion@
|
@initBashCompletion@
|
||||||
|
|
||||||
# Some aliases.
|
# Some aliases.
|
||||||
|
|
Loading…
Reference in New Issue