2022-03-30 09:31:56 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
2022-04-03 18:54:34 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
cfg = config.programs._1password-gui;
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
in
|
|
|
|
{
|
2022-07-18 16:21:45 +00:00
|
|
|
imports = [
|
2024-05-15 15:35:15 +00:00
|
|
|
(lib.mkRemovedOptionModule [ "programs" "_1password-gui" "gid" ] ''
|
2022-07-18 16:21:45 +00:00
|
|
|
A preallocated GID will be used instead.
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
options = {
|
|
|
|
programs._1password-gui = {
|
2024-05-15 15:35:15 +00:00
|
|
|
enable = lib.mkEnableOption "the 1Password GUI application";
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
polkitPolicyOwners = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
2022-04-03 18:54:34 +00:00
|
|
|
default = [ ];
|
2024-05-15 15:35:15 +00:00
|
|
|
example = lib.literalExpression ''["user1" "user2" "user3"]'';
|
2024-04-21 15:54:59 +00:00
|
|
|
description = ''
|
2022-04-03 18:54:34 +00:00
|
|
|
A list of users who should be able to integrate 1Password with polkit-based authentication mechanisms.
|
|
|
|
'';
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
package = lib.mkPackageOption pkgs "1Password GUI" {
|
2022-04-03 18:54:34 +00:00
|
|
|
default = [ "_1password-gui" ];
|
2022-03-30 09:31:56 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
config =
|
|
|
|
let
|
|
|
|
package = cfg.package.override {
|
|
|
|
polkitPolicyOwners = cfg.polkitPolicyOwners;
|
|
|
|
};
|
|
|
|
in
|
2024-05-15 15:35:15 +00:00
|
|
|
lib.mkIf cfg.enable {
|
2022-04-03 18:54:34 +00:00
|
|
|
environment.systemPackages = [ package ];
|
2022-07-18 16:21:45 +00:00
|
|
|
users.groups.onepassword.gid = config.ids.gids.onepassword;
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
security.wrappers = {
|
|
|
|
"1Password-BrowserSupport" = {
|
|
|
|
source = "${package}/share/1password/1Password-BrowserSupport";
|
2022-03-30 09:31:56 +00:00
|
|
|
owner = "root";
|
|
|
|
group = "onepassword";
|
|
|
|
setuid = false;
|
|
|
|
setgid = true;
|
|
|
|
};
|
2022-04-03 18:54:34 +00:00
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
|
2022-04-03 18:54:34 +00:00
|
|
|
};
|
2022-03-30 09:31:56 +00:00
|
|
|
}
|