aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdback <tyler@tdback.net>2025-01-29 18:44:48 -0500
committertdback <tyler@tdback.net>2025-01-29 18:44:48 -0500
commitf93a66c0c2a26d217c75b5bad7e7c9cb335c8c91 (patch)
treeca7bc28d5b53a7e3ba105a89a672ebeb09b0338e
parent9d5b24e6ccb340c65ac9ac364f71834f8bb496fe (diff)
shell: update prompt. show hostname when on a serverHEADmain
-rw-r--r--users/tdback/modules/shell/default.nix104
1 files changed, 52 insertions, 52 deletions
diff --git a/users/tdback/modules/shell/default.nix b/users/tdback/modules/shell/default.nix
index 3326837..329ac96 100644
--- a/users/tdback/modules/shell/default.nix
+++ b/users/tdback/modules/shell/default.nix
@@ -1,61 +1,61 @@
{
- programs = {
- zoxide = {
- enable = true;
- enableBashIntegration = true;
- options = [ "--cmd cd" ];
- };
-
- bash = {
- enable = true;
- historyFile = "~/.bash_history";
- historyControl = [
- "ignoredups"
- "ignorespace"
- ];
- shellOptions = [ "histappend" ];
- initExtra = ''
- PS1="
- \[\e[34m\]\u\[\e[33m\] at \[\e[34m\]\h\[\e[33m\] in \[\e[34m\]\w
- \[\e[33m\]λ\[\e[0m\] "
+ headless,
+ ...
+}:
+{
+ programs.bash = {
+ enable = true;
+ historyFile = "~/.bash_history";
+ historyControl = [
+ "ignoredups"
+ "ignorespace"
+ ];
+ shellOptions = [ "histappend" ];
+ initExtra = ''
+ # Shell prompt.
+ PS1="${if headless then ''\[\e[31m\][\h] '' else ""}\[\e[34m\]\w \[\e[33m\]λ\[\e[0m\] "
- # Set sane options.
- set -o noclobber
- set -o vi
- bind "\C-l":clear-screen
- bind "\C-p":previous-history
- bind "\C-n":next-history
- '';
+ # Sane options.
+ set -o noclobber
+ set -o vi
+ bind "\C-l":clear-screen
+ bind "\C-p":previous-history
+ bind "\C-n":next-history
+ '';
- profileExtra = ''
- # Add script directories to PATH.
- PATH=$PATH:$HOME/scripts
- PATH=$PATH:$HOME/.local/bin
+ profileExtra = ''
+ # Add script directories to PATH.
+ PATH=$PATH:$HOME/scripts
+ PATH=$PATH:$HOME/.local/bin
- # Clean up duplicate entries in PATH while preserving directory order.
- PATH="$(echo $PATH | tr ':' '\n' | awk '!a[$0]++' | tr '\n' ':' | sed 's/:$//')"
- '';
+ # Clean up duplicate entries in PATH while preserving directory order.
+ PATH="$(echo $PATH | tr ':' '\n' | awk '!a[$0]++' | tr '\n' ':' | sed 's/:$//')"
+ '';
- sessionVariables = {
- BROWSER = "firefox";
- EDITOR = "vi";
- KEYTIMEOUT = 1;
- LC_ALL = "en_US.UTF-8";
- LESSHISTFILE = "-";
- MANPAGER = "less -R --use-color -Dd+r -Du+b";
- };
+ sessionVariables = {
+ BROWSER = "firefox";
+ EDITOR = "vi";
+ KEYTIMEOUT = 1;
+ LC_ALL = "en_US.UTF-8";
+ LESSHISTFILE = "-";
+ MANPAGER = "less -R --use-color -Dd+r -Du+b";
+ };
- shellAliases = {
- cp = "cp -i";
- mv = "mv -i";
- rm = "rm -I";
- ls = "ls --color=auto";
- cat = "bat -pp";
- grep = "grep --color=auto";
- diff = "diff --color=auto";
- mkdir = "mkdir -p";
- deploy-flake = "f() { deploy .#$1 -s --remote-build --auto-rollback false && rsync -ax --delete ./ $1:/etc/nixos/; }; f";
- };
+ shellAliases = {
+ cp = "cp -i";
+ mv = "mv -i";
+ rm = "rm -I";
+ ls = "ls --color=auto";
+ cat = "bat -pp";
+ grep = "grep --color=auto";
+ diff = "diff --color=auto";
+ mkdir = "mkdir -p";
+ deploy-flake = "f() { deploy .#$1 -s --remote-build --auto-rollback false && rsync -ax --delete ./ $1:/etc/nixos/; }; f";
};
};
+
+ programs.zoxide = {
+ enable = true;
+ options = [ "--cmd cd" ];
+ };
}