Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Shell

Platforms: NixOS and nix-darwin. See Darwin.

Shell modules under othrys.system.shell.*. Located in modules/system/shell/.

Available Modules

ModuleOptionDescription
Zshothrys.system.shell.zshPrimary shell with plugins, completions, aliases
Bashothrys.system.shell.bashFallback shell
Starshipothrys.system.shell.starshipCross-shell prompt

Zsh

Full-featured Zsh with:

  • Plugin management (syntax highlighting, autosuggestions, completions)
  • Direnv integration for automatic dev shell activation
  • Zoxide for smart directory jumping
  • Toggleable alias presets (aliasPresets.{nix,navigation,modernUnix,editor,git,python,jvm,ansible,opentofu,node,docker,clipboard}, all on by default except clipboard, which follows othrys.desktop.graphical on NixOS and is off on darwin, where macOS has its own pbcopy) plus extraAliases for consumer additions
  • Persistence for history and the zoxide database. History is kept in ~/.local/share/zsh/history, and the module persists that directory rather than the file, since zsh saves history by renaming a temporary file over HISTFILE and a rename onto a bind-mounted file fails. The direnv allow database is persisted by othrys.apps.development, which owns direnv.

Enabling zsh makes it the primary user’s login shell through othrys.system.users.defaultShell, which a host overrides when it wants another. On darwin the login shell applies only to an account nix-darwin owns, which takes othrys.system.users.uid, and the nix preset’s rebuild runs darwin-rebuild switch, with no rebuild-test. The nix preset’s nix-clean keeps a week of generations, so a rollback target survives it.

The default editor behind EDITOR/VISUAL, git’s core.editor, and the v/vim/vi aliases is othrys.system.defaultEditor (default vim). The variables are set once, through environment.variables, and an editor module such as nixvim makes itself the default with mkDefault when enabled.

Starship

Minimal, fast prompt with Git integration. Every segment the module formats, the directory included, sits in square brackets with no space between segments, so a prompt reads like [alice@host][src][ main]. The first segment holds the user and the host and shows on every host, local or over SSH. The time sits in brackets on the right. Its colours come from othrys.theme.palette. On a host with no palette the layout is the same and each colour is an ANSI name, which the terminal resolves.