1Password: Difference between revisions
m Fix broken 1Password Community link |
Format an clean up the nix code |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 7: | Line 7: | ||
If you're using [[NixOS]], you can enable 1Password and its GUI with: | If you're using [[NixOS]], you can enable 1Password and its GUI with: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | { | ||
lib, | |||
... | |||
}: | |||
{ | { | ||
# Enable the unfree 1Password packages | # Enable the unfree 1Password packages | ||
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ | nixpkgs.config.allowUnfreePredicate = | ||
pkg: | |||
builtins.elem (lib.getName pkg) [ | |||
"1password-cli" | |||
"1password-gui" | |||
"1password" | |||
]; | |||
# Alternatively, you could also just allow all unfree packages | # Alternatively, you could also just allow all unfree packages | ||
# nixpkgs.config.allowUnfree = true; | # nixpkgs.config.allowUnfree = true; | ||
| Line 24: | Line 31: | ||
polkitPolicyOwners = [ "yourUsernameHere" ]; | polkitPolicyOwners = [ "yourUsernameHere" ]; | ||
}; | }; | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
| Line 42: | Line 48: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | |||
environment.etc = { | |||
"1password/custom_allowed_browsers" = { | |||
text = '' | |||
vivaldi-bin | |||
wavebox | |||
''; | |||
mode = "0755"; | |||
}; | }; | ||
}; | |||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 70: | Line 78: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | |||
pkgs, | |||
... | |||
}: | |||
{ | |||
home.packages = [ | home.packages = [ | ||
pkgs._1password | pkgs._1password | ||
pkgs._1password-gui | pkgs._1password-gui | ||
]; | ]; | ||
} | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 87: | Line 102: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | |||
config, | |||
pkgs, | |||
in { | ... | ||
}: | |||
let | |||
onePassPath = | |||
if pkgs.stdenv.isDarwin then | |||
"${config.home.homeDirectory}/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock" | |||
else | |||
"${config.home.homeDirectory}/.1password/agent.sock"; | |||
in | |||
{ | |||
home.sessionVariables.SSH_AUTH_SOCK = onePassPath; | |||
# or, alternatively, set it in `.ssh/config` which has higher precedence: | |||
programs.ssh = { | programs.ssh = { | ||
enable = true; | enable = true; | ||
| Line 106: | Line 134: | ||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | |||
lib, | |||
pkgs, | |||
... | |||
}: | |||
{ | { | ||
programs.git = { | programs.git = { | ||