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