2022-03-26 00:50:04 +00:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
|
|
|
|
with 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-03-26 00:50:04 +00:00
|
|
|
options = {
|
|
|
|
programs._1password = {
|
2022-03-29 23:11:13 +00:00
|
|
|
enable = mkEnableOption "the 1Password CLI tool";
|
2022-03-26 00:50:04 +00:00
|
|
|
|
2022-03-29 23:11:13 +00:00
|
|
|
gid = mkOption {
|
|
|
|
type = types.addCheck types.int (x: x >= 1000);
|
2022-03-26 00:50:04 +00:00
|
|
|
example = literalExpression "5001";
|
|
|
|
description = ''
|
2022-03-29 23:11:13 +00:00
|
|
|
The gid to assign to the onepassword-cli group, which is needed for integration with the 1Password GUI.
|
|
|
|
It must be 1000 or greater.
|
2022-03-26 00:50:04 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2022-03-29 23:11:13 +00:00
|
|
|
package = mkPackageOption pkgs "1Password CLI" {
|
|
|
|
default = [ "_1password" ];
|
2022-03-26 00:50:04 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ cfg.package ];
|
2022-03-29 23:11:13 +00:00
|
|
|
users.groups.onepassword-cli.gid = cfg.gid;
|
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;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|