config/users/pbsds/home/profiles/shell.nix
2023-06-24 14:48:53 +02:00

92 lines
2.2 KiB
Nix

{ pkgs, ... }:
{
# TODO: "bind -s 'set completion-ignore-case on'"
programs.bash.enable = true;
#programs.bash.enableCompletion = true;
programs.bash.shellOptions = [
# Append to history file rather than replacing it.
"histappend"
# check the window size after each command and, if
# necessary, update the values of LINES and COLUMNS.
"checkwinsize"
# Extended globbing.
"extglob"
"globstar"
# Warn if closing shell with running jobs.
"checkjobs"
];
imports = [ ../modules/jump.nix ];
programs.jump.enableBash = true; # TODO: upstream?
programs.fzf.enable = true; # TODO: does this conflict with system-wide setup?
programs.exa.enable = true;
programs.exa.enableAliases = true;
# i can't type
home.shellAliases.sl = "exa";
home.shellAliases.dc = "cd";
programs.direnv.enable = true;
programs.tealdeer.enable = true;
# just use ncdu lol
home.shellAliases.dush = "du -shc * | sort -h";
home.shellAliases.dushd = "du -shc * .[!.]?* | sort -h";
home.shellAliases.open = "xdg-open";
home.shellAliases.diff = "diff -u --color"; # eyo
home.shellAliases.ip = "ip -br -color";
home.shellAliases.rssh = "ssh -l root";
home.shellAliases.sudo = "sudo ";
home.shellAliases.watch = "watch -c "; # parse colors
home.shellAliases.xargs = "xargs ";
home.packages = with pkgs; [
rsync
bind.dnsutils
vimv
git
curl
wget
sshuttle
#tldr
entr
axel aria aria2
xe # xargs alternative
sd # sed alternative
fd # find alternative
silver-searcher # 'ag'
ripgrep # 'rg'
gron
jq
yq # includes xmlq and tomlq
fq # binary jq
htmlq
just # justfile
sysz
du-dust # du alternative
ncdu # Disk usage analyzer with an ncurses interface
xplr # tui file explorer
aha
];
programs.bash.initExtra = ''
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1='\[\033[01;32m\]\u@\h\[\033[01;37m\] \[\033[01;34m\]\W\[\033[33m\]$(parse_git_branch)\[\033[01;32m\]\$\[\033[00m\] '
# tldr
if command -v tldr >/dev/null; then
complete -F _command tldr
fi
'';
}