shell.nix

 1# Interactive shell on every host, whatever its layout (bug d76e0c1).
 2#
 3# Ghostty sends TERM=xterm-ghostty, which ncurses doesn't know yet: without
 4# its terminfo, less, htop, systemctl's pager and the like refuse to draw.
 5# Installing the entry keeps truecolor and doesn't override what tmux sets.
 6#
 7# Bash gets the readline and shopt settings of this repo's devenv shell, for
 8# interactive shells only (bash-completion is on by default in NixOS).
 9{ pkgs, ... }:
10
11{
12  environment.systemPackages = [ pkgs.ghostty.terminfo ];
13
14  programs.bash.interactiveShellInit = ''
15    # Fish-like completion and history search
16    bind 'set completion-ignore-case on'
17    bind 'set show-all-if-ambiguous on'
18    bind 'set menu-complete-display-prefix on'
19    bind 'TAB:menu-complete'
20    bind '"\e[A":history-search-backward'
21    bind '"\e[B":history-search-forward'
22    bind 'set colored-completion-prefix on'
23    bind 'set colored-stats on'
24
25    # Directory names alone cd; minor typos in them are corrected
26    shopt -s autocd dirspell cdspell
27    # ** matches recursively
28    shopt -s globstar
29  '';
30}