Jump to content

Zoxide: Difference between revisions

From NixOS Wiki
Explain a gotcha around enabling home-manager configuration of shell
Angel (talk | contribs)
m Change programs.zoxide.options to programs.zoxide.flags
 
Line 41: Line 41:
== Extra Options ==
== Extra Options ==


You can pass [https://github.com/ajeetdsouza/zoxide?tab=readme-ov-file#flags extra flags] to Zoxide using <code>programs.zoxide.options</code> as follows:
You can pass [https://github.com/ajeetdsouza/zoxide?tab=readme-ov-file#flags extra flags] to Zoxide using <code>programs.zoxide.flags</code> as follows:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
programs.zoxide.options = [
programs.zoxide.flags = [
   "--cmd cd"
   "--cmd cd"
];
];

Latest revision as of 17:18, 22 June 2025

Zoxide is a smarter cd (change directory) command that supports all major shells.

Installation

A basic user-specific installation with Home Manager may look like this:

home-manager.users.myuser = {
  programs.zoxide.enable = true;
};

Change myuser to the username of the user you want to configure.

It may also be necessary to add zoxide to home.packages if it hasn't already been installed by some other method:

home.packages = with pkgs; [
  zoxide
];

Shell Integration

You can choose which shell integrations to enable with the enable*Integration options. By default all are enabled.

programs.zoxide.enableBashIntegration= true;
programs.zoxide.enableFishIntegration= true;
programs.zoxide.enableNushellIntegration = true;
programs.zoxide.enableZshIntegration = true;

It may be necessary to also ensure that Home Manager can modify your rc file; for example, bash may require:

programs.bash.enable = true;

After adding Zoxide, you will have to restart your shell to gain access to the z command.

Extra Options

You can pass extra flags to Zoxide using programs.zoxide.flags as follows:

programs.zoxide.flags = [
  "--cmd cd"
];