> ## Documentation Index
> Fetch the complete documentation index at: https://www.1password.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure shell plugins using Nix

If you're using Nix to manage your shell configuration, you can configure 1Password Shell Plugins natively within your Nix configuration.

1. Add the 1Password Shell Plugins flake to your flake inputs:

   ```nix theme={null}
   {
     description = "My NixOS system flake";
     inputs = {
       nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
       # import the 1Password Shell Plugins Flake
       _1password-shell-plugins.url = "github:1Password/shell-plugins";
       # the rest of your flake inputs here
     };

     outputs = inputs@{ nixpkgs, ... }: {
       # the rest of your flake here
     }
   }
   ```

2. Somewhere in your flake output configuration, import and use the appropriate module:

   <Tabs groupId="with-or-without-home-manager">
     <Tab title="NixOS without home-manager">
       ```nix theme={null}
       {
           # import the NixOS module
           imports = [ inputs._1password-shell-plugins.nixosModules.default ];
           programs._1password-shell-plugins = {
             # enable 1Password shell plugins for bash, zsh, and fish shell
             enable = true;
             # the specified packages as well as 1Password CLI will be
             # automatically installed and configured to use shell plugins
             plugins = with pkgs; [ gh awscli2 cachix ];
           };
           # this can also be `programs.bash` or `programs.fish`
           programs.zsh = {
             enable = true;
             # the rest of your shell configuration here
           };
       }
       ```
     </Tab>

     <Tab title="Nix with home-manager">
       ```nix theme={null}
       {
           # import the home-manager module
           imports = [ inputs._1password-shell-plugins.hmModules.default ];
           programs._1password-shell-plugins = {
             # enable 1Password shell plugins for bash, zsh, and fish shell
             enable = true;
             # the specified packages as well as 1Password CLI will be
             # automatically installed and configured to use shell plugins
             plugins = with pkgs; [ gh awscli2 cachix ];
           };
           # this can also be `programs.bash` or `programs.fish`
           programs.zsh = {
             enable = true;
             # the rest of your shell configuration here
           };
       }
       ```
     </Tab>
   </Tabs>

3. Apply the updated configuration:

   <Tabs groupId="with-or-without-home-manager">
     <Tab title="NixOS (including home-manager as a NixOS module)">
       `~/path/to/flake/directory/` should be the path
       to the directory containing your `flake.nix` file, and `my-computer`
       should be the name of the flake output to use as the system configuration.

       <br />

       <br />

       ```shell theme={null}
       sudo nixos-rebuild switch --flake "~/path/to/flake/directory/.#my-computer"
       ```
     </Tab>

     <Tab title="Nix with standalone home-manager">
       `~/path/to/flake/directory/` should be the path
       to the directory containing your `flake.nix` file, and `my-computer`
       should be the name of the flake output to use as the system configuration.

       <br />

       <br />

       ```shell theme={null}
       home-manager switch --flake "~/path/to/flake/directory/.#my-computer"
       ```
     </Tab>
   </Tabs>
