shell: ghostty terminfo and fish-like interactive bash on every host (d76e0c1)
3 files changed,  +32, -1
M README.md
+1, -1
1@@ -15,7 +15,7 @@ The fleet: every NixOS host, deployed with [Colmena](https://github.com/zhaofeng
2 | `flake.nix` | Inputs: `nixpkgs` (pinned by rev to the one sovrn and moods lock), `nixpkgs-stable` (nixos-26.05, by rev), colmena, disko, pgit, sovrn, moods. Outputs `colmenaHive` and `nixosConfigurations` (the same systems). |
3 | `hosts.json` | Inventory: roles, provider or layout, addresses, pinned SSH host key, stateVersion. See the header of `hive.nix`. |
4 | `hive.nix` | Turns the inventory into the Colmena hive. Evaluation fails if sovrn's or moods' nixpkgs differs from the fleet's. |
5-| `modules/` | Fleet modules for standard hosts: `base`, `vm` (disko, GRUB), `hetzner`, `netcup`, `secrets` (`servers.secrets`), plus `fleet` (role checks) and `caddy` (ACME email `[email protected]`) on every host. |
6+| `modules/` | Fleet modules for standard hosts: `base`, `vm` (disko, GRUB), `hetzner`, `netcup`, `secrets` (`servers.secrets`), plus `fleet` (role checks), `caddy` (ACME email `[email protected]`) and `shell` (ghostty terminfo, fish-like bash for interactive sessions) on every host. |
7 | `roles/` | Roles that live here (`forge`). Project roles come from the project flakes. |
8 | `hosts/<fqdn-with-dashes>/` | Legacy hosts only: hand-written hardware, networking, stateVersion. `hosts/common/` is shared by them. |
9 | `keys/admins.pub` | Root SSH keys for standard hosts. |
M hive.nix
+1, -0
1@@ -200,6 +200,7 @@ let
2     ++ [
3       ./modules/fleet.nix
4       ./modules/caddy.nix
5+      ./modules/shell.nix
6       { fleet.roles = host.roles or [ ]; }
7     ]
8     ++ lib.concatMap (modulesForRole host) (host.roles or [ ])
A modules/shell.nix
+30, -0
 1@@ -0,0 +1,30 @@
 2+# Interactive shell on every host, whatever its layout (bug d76e0c1).
 3+#
 4+# Ghostty sends TERM=xterm-ghostty, which ncurses doesn't know yet: without
 5+# its terminfo, less, htop, systemctl's pager and the like refuse to draw.
 6+# Installing the entry keeps truecolor and doesn't override what tmux sets.
 7+#
 8+# Bash gets the readline and shopt settings of this repo's devenv shell, for
 9+# interactive shells only (bash-completion is on by default in NixOS).
10+{ pkgs, ... }:
11+
12+{
13+  environment.systemPackages = [ pkgs.ghostty.terminfo ];
14+
15+  programs.bash.interactiveShellInit = ''
16+    # Fish-like completion and history search
17+    bind 'set completion-ignore-case on'
18+    bind 'set show-all-if-ambiguous on'
19+    bind 'set menu-complete-display-prefix on'
20+    bind 'TAB:menu-complete'
21+    bind '"\e[A":history-search-backward'
22+    bind '"\e[B":history-search-forward'
23+    bind 'set colored-completion-prefix on'
24+    bind 'set colored-stats on'
25+
26+    # Directory names alone cd; minor typos in them are corrected
27+    shopt -s autocd dirspell cdspell
28+    # ** matches recursively
29+    shopt -s globstar
30+  '';
31+}