From 414ad642b2645adf5bdf73810eca36852d7a0a12 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Tue, 26 Mar 2024 08:25:23 -0400 Subject: [PATCH] decouple 1Password --- home/_1password.nix | 23 +++++++++++++++++++++++ home/default.nix | 1 + home/ssh.nix | 10 +--------- home/zsh.nix | 3 +-- nixos/gui/desktopish/guiapps.nix | 3 --- 5 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 home/_1password.nix diff --git a/home/_1password.nix b/home/_1password.nix new file mode 100644 index 0000000..92eeb66 --- /dev/null +++ b/home/_1password.nix @@ -0,0 +1,23 @@ +{ pkgs, lib, ... }: +{ + home.packages = with pkgs; [ + _1password + gh + ]; + + programs.zsh.envExtra = '' + # For 1Password CLI. This requires `pkgs.gh` to be installed. + source $HOME/.config/op/plugins.sh + ''; + + programs.ssh = { + enable = true; + matchBlocks = { + # Configure 1Password agent only on macOS; whilst using agent forwarding + # to make it available to Linux machines. + "*".extraOptions = lib.mkIf pkgs.stdenv.isDarwin { + identityAgent = ''"~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"''; + }; + }; + }; +} diff --git a/home/default.nix b/home/default.nix index d825e51..7ef13ca 100644 --- a/home/default.nix +++ b/home/default.nix @@ -7,6 +7,7 @@ imports = [ inputs.nixvim.homeManagerModules.nixvim inputs.nix-index-database.hmModules.nix-index + ./_1password.nix ./tmux.nix ./neovim.nix # ./helix.nix diff --git a/home/ssh.nix b/home/ssh.nix index 7ed4d09..8693b3b 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -1,18 +1,10 @@ { pkgs, lib, ... }: -let - inherit (pkgs) stdenv; -in { programs.ssh = { enable = true; matchBlocks = { - # Configure 1Password agent only on macOS; whilst using agent forwarding - # to make it available to Linux machines. - "*".extraOptions = lib.mkIf stdenv.isDarwin { - identityAgent = ''"~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"''; - }; vanjaram = { - hostname = "100.94.107.36"; + hostname = "100.83.79.127"; user = "srid"; forwardAgent = true; }; diff --git a/home/zsh.nix b/home/zsh.nix index 16a2eaf..8d41262 100644 --- a/home/zsh.nix +++ b/home/zsh.nix @@ -19,8 +19,7 @@ # But also see: 'doom env', which is what works. envExtra = '' export PATH=/etc/profiles/per-user/$USER/bin:/run/current-system/sw/bin/:/usr/local/bin:$PATH - # For 1Password CLI. This requires `pkgs.gh` to be installed. - source $HOME/.config/op/plugins.sh + # Because, adding it in .ssh/config is not enough. # cf. https://developer.1password.com/docs/ssh/get-started#step-4-configure-your-ssh-or-git-client export SSH_AUTH_SOCK=~/Library/Group\ Containers/2BUA8C4S2C.com.1password/t/agent.sock diff --git a/nixos/gui/desktopish/guiapps.nix b/nixos/gui/desktopish/guiapps.nix index 874bc33..571e792 100644 --- a/nixos/gui/desktopish/guiapps.nix +++ b/nixos/gui/desktopish/guiapps.nix @@ -10,9 +10,6 @@ # onlyoffice-bin obsidian - _1password - _1password-gui - simplescreenrecorder obs-studio