2022-03-16 18:09:37 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2022-03-29 23:08:17 +00:00
|
|
|
|
2022-03-16 18:09:37 +00:00
|
|
|
cfg = config.programs._1password-gui;
|
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
in
|
|
|
|
{
|
2022-03-16 18:09:37 +00:00
|
|
|
options = {
|
|
|
|
programs._1password-gui = {
|
2022-03-29 23:08:17 +00:00
|
|
|
enable = mkEnableOption "the 1Password GUI application";
|
2022-03-16 18:09:37 +00:00
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
gid = mkOption {
|
|
|
|
type = types.addCheck types.int (x: x >= 1000);
|
2022-03-16 18:09:37 +00:00
|
|
|
example = literalExpression "5000";
|
|
|
|
description = ''
|
2022-03-29 23:08:17 +00:00
|
|
|
The gid to assign to the onepassword group, which is needed for browser integration.
|
|
|
|
It must be 1000 or greater.
|
|
|
|
'';
|
2022-03-16 18:09:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
polkitPolicyOwners = mkOption {
|
|
|
|
type = types.listOf types.str;
|
2022-03-29 23:08:17 +00:00
|
|
|
default = [ ];
|
|
|
|
example = literalExpression ''["user1" "user2" "user3"]'';
|
2022-03-16 18:09:37 +00:00
|
|
|
description = ''
|
2022-03-29 23:08:17 +00:00
|
|
|
A list of users who should be able to integrate 1Password with polkit-based authentication mechanisms.
|
|
|
|
'';
|
2022-03-16 18:09:37 +00:00
|
|
|
};
|
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
package = mkPackageOption pkgs "1Password GUI" {
|
|
|
|
default = [ "_1password-gui" ];
|
2022-03-16 18:09:37 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
package = cfg.package.override {
|
|
|
|
polkitPolicyOwners = cfg.polkitPolicyOwners;
|
|
|
|
};
|
|
|
|
in
|
|
|
|
mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ package ];
|
|
|
|
users.groups.onepassword.gid = cfg.gid;
|
2022-03-16 18:09:37 +00:00
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
security.wrappers = {
|
|
|
|
"1Password-BrowserSupport" = {
|
|
|
|
source = "${package}/share/1password/1Password-BrowserSupport";
|
2022-03-16 18:09:37 +00:00
|
|
|
owner = "root";
|
|
|
|
group = "onepassword";
|
|
|
|
setuid = false;
|
|
|
|
setgid = true;
|
|
|
|
};
|
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
"1Password-KeyringHelper" = {
|
|
|
|
source = "${package}/share/1password/1Password-KeyringHelper";
|
2022-03-16 18:09:37 +00:00
|
|
|
owner = "root";
|
|
|
|
group = "onepassword";
|
|
|
|
setuid = true;
|
|
|
|
setgid = true;
|
|
|
|
};
|
2022-03-29 23:08:17 +00:00
|
|
|
};
|
2022-03-16 18:09:37 +00:00
|
|
|
|
2022-03-29 23:08:17 +00:00
|
|
|
};
|
2022-03-16 18:09:37 +00:00
|
|
|
}
|