1password: make ssh agent/signing work on Linux

This commit is contained in:
Sridhar Ratnakumar 2024-10-22 20:20:13 -04:00
parent d7bc3cf426
commit bb33fbc0e8
No known key found for this signature in database
3 changed files with 11 additions and 7 deletions

View file

@ -5,7 +5,7 @@
gh
];
programs.zsh.envExtra = ''
programs.zsh.envExtra = lib.mkIf pkgs.stdenv.isDarwin ''
# For 1Password CLI. This requires `pkgs.gh` to be installed.
# source $HOME/.config/op/plugins.sh
'';
@ -13,10 +13,11 @@
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"'';
"*".extraOptions = {
identityAgent =
if pkgs.stdenv.isDarwin
then ''"~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock"''
else ''"~/.1password/agent.sock"'';
};
};
};
@ -30,7 +31,10 @@
contents = {
user.signingKey = flake.config.me.sshKey;
gpg.format = "ssh";
gpg.ssh.program = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
gpg.ssh.program =
if pkgs.stdenv.isDarwin
then "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"
else "/run/current-system/sw/bin/op-ssh-sign";
commit.gpgsign = true;
};
}];

View file

@ -2,7 +2,6 @@
imports = [
./all/zsh.nix
./all/wezterm
./all/_1password.nix
# ./all/emacs.nix
];
}

View file

@ -1,6 +1,7 @@
{
home.stateVersion = "22.11";
imports = [
./all/_1password.nix
./all/tmux.nix
./all/neovim
# ./helix.nix