{ pkgs, lib, ... }: with lib; { programs.bash = { enable = mkDefault true; shellAliases = { black-on-white = "echo -e '\\033]11;black\\007\\033]10;white\\007'"; c = "bat"; cl = "clear"; eic = "edit-in-commit"; eigg = "edit-in-git-grep"; emacs = "emacsclient --create-frame"; g = "git"; gg = "git grep"; grep = "grep --color"; j = "sudo journalctl -u"; jb = "sudo journalctl -b"; l = "ls -alh"; ll = "ls -al"; ls = "ls --color=tty"; md-toc = "grep '^#\\+' --color"; mem = "ps -e -orss=,user=,args= | sort -b -k1,1n"; mem-top = "smem --sort rss --autosize"; mpl = "mplayer"; nf = "sudo nft list ruleset | less"; nixos-clean = "sudo nix-collect-garbage -d"; nixos-history = "sudo nix-env --list-generations --profile /nix/var/nix/profiles/system"; nixos-rollback = "sudo nixos-rebuild switch --rollback"; pass-gen = "tr -d -C A-Za-z0-9_- /dev/null | while IFS=: read -r file x size x do pid=''${file#/proc/} pid=''${pid%/smaps} size=''${size% kB} size=''${size##* } if test "$pid" = "$lastpid" then swap=$(( swap + size )) else if test "$swap" -gt 0 then printf "%u pid=%u cmd=%s\n" "$swap" "$lastpid" "$(tr '\000' ' ' &2 "$i" test "$(zfs get -Ho value encryptionroot $i)" = "$1" || zfs change-key -li "$i" done } ''; profileExtra = '' ''; }; programs.direnv.enableBashIntegration = true; #programs.broot.enableBashIntegration = true; programs.readline = { enable = mkDefault true; includeSystemConfig = true; bindings = { # Up/Down "\\e[A" = "history-search-backward"; "\\e[B" = "history-search-forward"; # Ctrl-Left/Ctrl-Right "\\e[1;5C" = "forward-word"; "\\e[1;5D" = "backward-word"; "\\e[5C" = "forward-word"; "\\e[5D" = "backward-word"; "\\e\\e[C" = "forward-word"; "\\e\\e[D" = "backward-word"; # Home/End "\\e[1~" = "beginning-of-line"; "\\e[4~" = "end-of-line"; # Delete/Insert "\\e[3~" = "delete-char"; "\\e[2~" = "quoted-insert"; # For non RH/Debian xterm, can't hurt for RH/Debian xterm "\\eOF" = "end-of-line"; "\\eOH" = "beginning-of-line"; # For freebsd console "\\e[F" = "end-of-line"; "\\e[H" = "beginning-of-line"; # $if term=rxvt "\\e[7~" = "beginning-of-line"; "\\e[8~" = "end-of-line"; "\\eOc" = "forward-word"; "\\eOd" = "backward-word"; # $endif }; variables = { # Be 8 bit clean. input-meta = mkDefault true; output-meta = mkDefault true; colored-completion-prefix = mkDefault true; colored-stats = mkDefault true; # Note that this may cause completion text blink in some terminals (e.g. xterm). echo-control-characters = mkDefault true; mark-symlinked-directories = mkDefault true; menu-complete-display-prefix = mkDefault true; show-all-if-ambiguous = mkDefault true; show-all-if-unmodified = mkDefault true; visible-stats = mkDefault false; # Append char to indicate type enable-bracketed-paste = mkDefault true; }; }; }