1Password: Difference between revisions

copyedit: restructure headings, add links
Jopejoe1 (talk | contribs)
Format an clean up the nix code
 
(8 intermediate revisions by 8 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>
{ config, lib, pkgs, ... }:
{
  lib,
  ...
}:
 
{
{
   # Enable the unfree 1Password packages
   # Enable the unfree 1Password packages
   nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
   nixpkgs.config.allowUnfreePredicate =
    "1password-gui"
    pkg:
    "1password"
    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" = {
  environment.etc = {
        text = ''
    "1password/custom_allowed_browsers" = {
          vivaldi-bin
      text = ''
          wavebox
        vivaldi-bin
        '';
        wavebox
        mode = "0755";
      '';
      };
      mode = "0755";
     };
     };
  };
}
</syntaxhighlight>
</syntaxhighlight>
=== Unlocking with System Authentication ===
1Password allows [https://support.1password.com/system-authentication-linux/ unlocking with system authentication]. This means fingerprints or login passwords may be used in addition to the master password. This must be enabled under the Security preferences tab of 1Password as outlined in the 1Password documentation, but also requires a few other system tools to work.
For the graphical authentication prompt to work, a user [[Polkit#Authentication_agents|Polkit authentication agent]] must be started. The authentication agent may automatically be started under Gnome, KDE, or other DE at login, but may need to be explicitly enabled for other window managers.
For fingerprint unlocking to work, [[Fingerprint scanner|fingerprint scanning]] to be enabled and allowed for typical system authentication.


== Home Manager ==
== Home Manager ==


{{warning|1=Non-[[NixOS]] installs [https://1password.community/discussion/comment/655813/#Comment_655813 will not link with browser extensions or system authentication] }}
{{warning|1=Non-[[NixOS]] installs [https://www.1password.community/discussions/1password/sandboxed-application-cant-communicate-with-browser-extension/91984/replies/92015 will not link with browser extensions or system authentication] }}


=== Installation ===
=== Installation ===
Line 62: 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 75: Line 98:


If 1Password manages your [[SSH]] keys and you use [[Home Manager]], you may also configure your <code>~/.ssh/config</code> file using Nix:
If 1Password manages your [[SSH]] keys and you use [[Home Manager]], you may also configure your <code>~/.ssh/config</code> file using Nix:
{{note|In order to start the 1Password SSH agent, you must open the 1Password settings, go to the Developer section and check the checkbox "Use the SSH agent".}}


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
_: let
{
   # onePassPath = "~/Library/Group Containers/2BUA8C4S2C.com.1password/t/agent.sock";
  config,
  onePassPath = "~/.1password/agent.sock";
  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 93: Line 131:
==== Configuring Git ====
==== Configuring Git ====


You can enable [[Git]]'s [[SSH]] singing with [[Home Manager]]:
You can enable [[Git]]'s [[SSH]] signing with [[Home Manager]]:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
{
  lib,
  pkgs,
  ...
}:
{
{
   programs.git = {
   programs.git = {
Line 119: Line 162:




[[Category:Software]]
[[Category:Applications]]