Auto-install missing commands in NixOS environments. Detects NixOS, searches for packages containing the missing command, and re-runs with nix shell...
Automatically handles "command not found" errors in NixOS environments by searching for packages and retrying with nix shell.
Activate this skill when:
/etc/nixos existence or NIX_STORE env var)/etc/nixos or NIX_STORE env varnix search nixpkgs <cmd> and pick best matchnix shell nixpkgs#<package> -c <original-command>Check if we're in NixOS:
test -d /etc/nixos || test -n "$NIX_STORE"
If the error output already includes a recommended nix shell nixpkgs#... -c ..., run it as-is.
Search locally and pick best match from plain text output:
nix search nixpkgs <cmd>
Selection order:
Then run:
nix shell nixpkgs#<package> -c <original-command>
If no match or too many ambiguous results, delegate to nixos agent to resolve.
tree commandtree /some/pathzsh: command not found: treenix search nixpkgs treetree package, run nix shell nixpkgs#tree -c tree /some/pathjq commandcat data.json | jq '.name'command not found: jqnix search nixpkgs jqjq package, run with stdin preservedcargo commandcargo buildcommand not found: cargonix search nixpkgs cargocargo package, run nix shell nixpkgs#cargo -c cargo builduse nix shell nixpkgs#ripgrep -c rg ...Try local selection order first. If still ambiguous, delegate to nixos agent.
Nixos agent handles command complexity:
Still proceed (might need different package). Inform user about current nix shell context.
If local search fails, delegate to nixos agent for broader search/fallbacks.
Return actual command results. Distinguish between "package not found" vs "command failed".
Monitor for these error patterns:
command not found: <cmd><cmd>: No such file or directoryzsh: command not found: <cmd>bash: <cmd>: command not foundOnly delegate when local search fails or ambiguous. When delegated, nixos agent handles:
nix searchDon't handle these (likely typos or not packages):
a, b, xsl, gerpcd, exportnixpkgs# (follows system channel)nixpkgs/unstable# for newest versions