diff options
author | Cole Helbling <cole.e.helbling@outlook.com> | 2022-03-29 16:08:17 -0700 |
---|---|---|
committer | Cole Helbling <cole.e.helbling@outlook.com> | 2022-03-30 08:23:27 -0700 |
commit | 6e6558711ffe0f41b58e68518e4deb3c39d464eb (patch) | |
tree | 521c3492adda415210efc0e2ecd8cdf41904b6be /nixos/modules/programs | |
parent | 83a83907913832494f17d0ed4fb70e521c03f0d0 (diff) |
nixos/_1password-gui: cleanup
* Change groupId to gid to align with the rest of NixOS modules * Add a check to the gid option to ensure it is greater than or equal to 1000 * Use the overridden package for the wrappers
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r-- | nixos/modules/programs/_1password-gui.nix | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/nixos/modules/programs/_1password-gui.nix b/nixos/modules/programs/_1password-gui.nix index f57de44bb9e26..42f6a0b52252c 100644 --- a/nixos/modules/programs/_1password-gui.nix +++ b/nixos/modules/programs/_1password-gui.nix @@ -3,67 +3,66 @@ with lib; let + cfg = config.programs._1password-gui; -in { +in +{ options = { programs._1password-gui = { - enable = mkEnableOption "The 1Password Desktop application with browser integration"; + enable = mkEnableOption "the 1Password GUI application"; - groupId = mkOption { - type = types.int; + gid = mkOption { + type = types.addCheck types.int (x: x >= 1000); example = literalExpression "5000"; description = '' - The GroupID to assign to the onepassword group, which is needed for browser integration. The group ID must be 1000 or greater. - ''; + The gid to assign to the onepassword group, which is needed for browser integration. + It must be 1000 or greater. + ''; }; polkitPolicyOwners = mkOption { type = types.listOf types.str; - default = []; - example = literalExpression "[\"user1\" \"user2\" \"user3\"]"; + default = [ ]; + example = literalExpression ''["user1" "user2" "user3"]''; description = '' - A list of users who should be able to integrate 1Password with polkit-based authentication mechanisms. By default, no users will have such access. - ''; + A list of users who should be able to integrate 1Password with polkit-based authentication mechanisms. + ''; }; - package = mkOption { - type = types.package; - default = pkgs._1password-gui; - defaultText = literalExpression "pkgs._1password-gui"; - example = literalExpression "pkgs._1password-gui"; - description = '' - The 1Password derivation to use. This can be used to upgrade from the stable release that we keep in nixpkgs to the betas. - ''; + package = mkPackageOption pkgs "1Password GUI" { + default = [ "_1password-gui" ]; }; }; }; - config = let - package = cfg.package.override { - polkitPolicyOwners = cfg.polkitPolicyOwners; - }; - in mkIf cfg.enable { - environment.systemPackages = [ package ]; - users.groups.onepassword.gid = cfg.groupId; + config = + let + package = cfg.package.override { + polkitPolicyOwners = cfg.polkitPolicyOwners; + }; + in + mkIf cfg.enable { + environment.systemPackages = [ package ]; + users.groups.onepassword.gid = cfg.gid; - security.wrappers = { - "1Password-BrowserSupport" = - { source = "${cfg.package}/share/1password/1Password-BrowserSupport"; + security.wrappers = { + "1Password-BrowserSupport" = { + source = "${package}/share/1password/1Password-BrowserSupport"; owner = "root"; group = "onepassword"; setuid = false; setgid = true; }; - "1Password-KeyringHelper" = - { source = "${cfg.package}/share/1password/1Password-KeyringHelper"; + "1Password-KeyringHelper" = { + source = "${package}/share/1password/1Password-KeyringHelper"; owner = "root"; group = "onepassword"; setuid = true; setgid = true; }; - }; + }; - }; + }; } |