2022-03-26 00:50:04 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
let
|
2022-03-29 23:11:13 +00:00
|
|
|
|
2022-03-26 00:50:04 +00:00
|
|
|
cfg = config.programs._1password;
|
2022-03-29 23:11:13 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
{
|
2022-05-08 10:48:29 +00:00
|
|
|
imports = [
|
2024-04-17 11:37:58 +00:00
|
|
|
(lib.mkRemovedOptionModule [ "programs" "_1password" "gid" ] ''
|
2022-05-08 10:48:29 +00:00
|
|
|
A preallocated GID will be used instead.
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
|
2022-03-26 00:50:04 +00:00
|
|
|
options = {
|
|
|
|
programs._1password = {
|
2024-04-17 11:37:58 +00:00
|
|
|
enable = lib.mkEnableOption "the 1Password CLI tool";
|
2022-03-26 00:50:04 +00:00
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
package = lib.mkPackageOption pkgs "1Password CLI" {
|
2024-10-24 14:45:01 +00:00
|
|
|
default = [ "_1password-cli" ];
|
2022-03-26 00:50:04 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-04-17 11:37:58 +00:00
|
|
|
config = lib.mkIf cfg.enable {
|
2022-03-26 00:50:04 +00:00
|
|
|
environment.systemPackages = [ cfg.package ];
|
2022-05-08 10:48:29 +00:00
|
|
|
users.groups.onepassword-cli.gid = config.ids.gids.onepassword-cli;
|
2022-03-26 00:50:04 +00:00
|
|
|
|
|
|
|
security.wrappers = {
|
|
|
|
"op" = {
|
|
|
|
source = "${cfg.package}/bin/op";
|
|
|
|
owner = "root";
|
|
|
|
group = "onepassword-cli";
|
|
|
|
setuid = false;
|
|
|
|
setgid = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|