-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy path1password.nix
52 lines (51 loc) · 1.28 KB
/
1password.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
config,
lib,
pkgs,
...
}: let
home = config.home.homeDirectory;
darwinSockPath = "${home}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock";
sockPath = ".1password/agent.sock";
aliases = {
# gh = "op plugin run -- gh";
# cachix = "op plugin run -- cachix";
# brew = "op plugin run -- brew";
};
in {
home.sessionVariables = {
SSH_AUTH_SOCK = "${home}/${sockPath}";
OP_PLUGIN_ALIASES_SOURCED = 1;
};
home.file.sock = lib.mkIf pkgs.stdenvNoCC.isDarwin {
source = config.lib.file.mkOutOfStoreSymlink darwinSockPath;
target = sockPath;
};
programs.bash = {
initExtra = lib.mkIf pkgs.stdenvNoCC.isDarwin ''
if command -v op >/dev/null; then
source <(op completion bash)
fi
'';
shellAliases = aliases;
};
programs.fish = {
interactiveShellInit = lib.mkIf pkgs.stdenvNoCC.isDarwin ''
op completion fish | source
'';
shellAliases = aliases;
};
programs.zsh = {
# handled by oh-my-zsh
# initExtra = lib.mkIf pkgs.stdenvNoCC.isDarwin ''
# if command -v op >/dev/null; then
# eval "$(op completion zsh)"; compdef _op op
# fi
# '';
shellAliases = aliases;
};
programs.ssh = {
enable = true;
extraConfig = "IdentityAgent ~/${sockPath}";
};
}