2024-09-25 04:29:25 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
with lib; let
|
2024-09-25 20:05:04 +00:00
|
|
|
cfg = config.custom.programs._1password;
|
2024-09-25 04:29:25 +00:00
|
|
|
in {
|
2024-12-21 18:42:52 +00:00
|
|
|
options.custom.programs._1password = {
|
|
|
|
enable = mkOption {default = false;};
|
|
|
|
agent = mkOption {default = true;};
|
|
|
|
browser = mkOption {default = null;};
|
|
|
|
};
|
2024-09-25 04:29:25 +00:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs = {
|
|
|
|
# https://developer.1password.com/
|
|
|
|
_1password.enable = true; # CLI
|
|
|
|
|
|
|
|
#!! Non-free license
|
|
|
|
# https://1password.com/
|
|
|
|
_1password-gui = {
|
|
|
|
enable = true;
|
|
|
|
package = pkgs._1password-gui-beta;
|
|
|
|
polkitPolicyOwners = [config.custom.username]; # Desktop integration
|
|
|
|
};
|
|
|
|
};
|
2024-12-21 18:42:52 +00:00
|
|
|
|
|
|
|
# https://wiki.nixos.org/wiki/1Password#Unlocking_browser_extensions
|
|
|
|
environment.etc = mkIf (isString cfg.browser) {
|
|
|
|
"1password/custom_allowed_browsers" = {
|
|
|
|
mode = "0755";
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
${cfg.browser}
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
home-manager.users.${config.custom.username} = {
|
|
|
|
programs.ssh.extraConfig = mkIf cfg.agent ''
|
|
|
|
Host *
|
|
|
|
IdentityAgent ~/.1password/agent.sock
|
|
|
|
'';
|
|
|
|
};
|
2024-09-25 04:29:25 +00:00
|
|
|
};
|
|
|
|
}
|