nixpkgs/nixos/modules/programs/_1password.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
961 B
Nix
Raw Normal View History

2022-03-26 00:50:04 +00:00
{ config, pkgs, lib, ... }:
with lib;
let
2022-03-26 00:50:04 +00:00
cfg = config.programs._1password;
in
{
2022-03-26 00:50:04 +00:00
options = {
programs._1password = {
enable = mkEnableOption "the 1Password CLI tool";
2022-03-26 00:50:04 +00:00
gid = mkOption {
type = types.addCheck types.int (x: x >= 1000);
2022-03-26 00:50:04 +00:00
example = literalExpression "5001";
description = ''
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
'';
};
package = mkPackageOption pkgs "1Password CLI" {
default = [ "_1password" ];
2022-03-26 00:50:04 +00:00
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
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;
};
};
};
}