Skip to main content
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:
    {
      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:
    {
        # 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
        };
    }
    
  3. Apply the updated configuration:
    ~/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.

    sudo nixos-rebuild switch --flake "~/path/to/flake/directory/.#my-computer"