Skip to content

nix-community/nix-zsh-completions

ZSH Completions for Nix and NixOS

This project aims to provide a highly complete set of ZSH completions for Nix, NixOS, NixOps, and the surrounding ecosystem.

NixOS

Setting programs.zsh.enable = true in /etc/nixos/configuration.nix will automatically install and enable nix-zsh-compeletions.

Oh-My-ZSH Installation

cd ~/.oh-my-zsh/custom/plugins
git clone git@github.com:nix-community/nix-zsh-completions.git

Then add nix-zsh-completions to the plugins list in ~/.zshrc

If you want your prompt to be prefixed by [nix-shell] when you're in a nix-shell add this to your zshrc:

prompt_nix_shell_setup

Antigen Installation

Add the following to ~/.zshrc

antigen bundle git@github.com:nix-community/nix-zsh-completions.git

Plain ZSH Installation

Clone this repository and add the following to ~/.zshrc with the path to nix-zsh-completions updated as necessary.

source $HOME/nix-zsh-completions/nix-zsh-completions.plugin.zsh
fpath=($HOME/nix-zsh-completions $fpath)
autoload -U compinit && compinit

Required ZSH version

The completion scripts are known to be broken in ZSH version 5.0.8 or older, 5.2 or newer works.

ZSH Completions Tutorial

zsh-completions-howto