> For the complete documentation index, see [llms.txt](https://manual.dxable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.dxable.com/1password/configure-shell-plugins-using-nix.md).

# Nixを使ってシェルプラグインを設定する

### **Nixを使ってシェルプラグインを設定する** <a href="#id-5yrrf6o4lmni" id="id-5yrrf6o4lmni"></a>

Nixを使ってシェル設定を管理している場合は、Nix設定内で1Password Shellプラグインをネイティブに設定できます。

* 1\. 1Password Shell Plugins フレークをフレーク入力に追加します。
* {
* 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\. flakeの出力設定のどこかに適切なモジュールをインポートして使います。
  * ホームマネージャーなしの NixOS
* {
* \# 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
* };
* }
  * ホームマネージャーありのNix
* {
* \# 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
* };
* }
* 3\. 更新された設定を適用します。
  * NixOS（NixOS モジュールとしてホームマネージャーを含む）
* \~/path/to/flake/directory/はflake.nixファイルを含むディレクトリーへのパスであり、my-computerはシステム設定として使うflake出力の名前です。
* sudo nixos-rebuild switch --flake "\~/path/to/flake/directory/.#my-computer"
  * スタンドアロンのホームマネージャーありのNix
* \~/path/to/flake/directory/はflake.nixファイルを含むディレクトリーへのパスであり、my-computerはシステム設定として使うflake出力の名前です。
* $ home-manager switch --flake "\~/path/to/flake/directory/.#my-computer"
