diff options
author | Michael Hoang <enzime@users.noreply.github.com> | 2022-03-26 11:50:04 +1100 |
---|---|---|
committer | Michael Hoang <enzime@users.noreply.github.com> | 2022-03-26 13:22:56 +1100 |
commit | d1ac88811f0235f9ba0834ab1ac970e6f4e7ffc0 (patch) | |
tree | 5d945b7d1ceaac177c92c44b4790e639eaaf9409 /nixos/modules/programs | |
parent | 4bbf1a90c4919b2918c2f2123179d8ccb60e8dde (diff) |
nixos/_1password: init
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/_1password.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/nixos/modules/programs/_1password.nix b/nixos/modules/programs/_1password.nix new file mode 100644 index 0000000000000..eae518e61ca73 --- /dev/null +++ b/nixos/modules/programs/_1password.nix @@ -0,0 +1,46 @@ +{ config, pkgs, lib, ... }: + +with lib; + +let + cfg = config.programs._1password; +in { + options = { + programs._1password = { + enable = mkEnableOption "The 1Password CLI tool with biometric unlock and integration with the 1Password GUI."; + + groupId = mkOption { + type = types.int; + example = literalExpression "5001"; + description = '' + The GroupID to assign to the onepassword-cli group, which is needed for integration with the 1Password GUI. The group ID must be 1000 or greater. + ''; + }; + + package = mkOption { + type = types.package; + default = pkgs._1password; + defaultText = literalExpression "pkgs._1password"; + example = literalExpression "pkgs._1password"; + description = '' + The 1Password CLI derivation to use. + ''; + }; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ cfg.package ]; + users.groups.onepassword-cli.gid = cfg.groupId; + + security.wrappers = { + "op" = { + source = "${cfg.package}/bin/op"; + owner = "root"; + group = "onepassword-cli"; + setuid = false; + setgid = true; + }; + }; + }; +} |