mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-09 12:05:50 +03:00
Merge pull request #166338 from cole-h/1p
nixos/_1password{,-gui}: cleanup
This commit is contained in:
commit
3807bedb36
2 changed files with 43 additions and 46 deletions
|
@ -3,61 +3,60 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.programs._1password-gui;
|
cfg = config.programs._1password-gui;
|
||||||
|
|
||||||
in {
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
programs._1password-gui = {
|
programs._1password-gui = {
|
||||||
enable = mkEnableOption "The 1Password Desktop application with browser integration";
|
enable = mkEnableOption "the 1Password GUI application";
|
||||||
|
|
||||||
groupId = mkOption {
|
gid = mkOption {
|
||||||
type = types.int;
|
type = types.addCheck types.int (x: x >= 1000);
|
||||||
example = literalExpression "5000";
|
example = literalExpression "5000";
|
||||||
description = ''
|
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 {
|
polkitPolicyOwners = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [ ];
|
||||||
example = literalExpression "[\"user1\" \"user2\" \"user3\"]";
|
example = literalExpression ''["user1" "user2" "user3"]'';
|
||||||
description = ''
|
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 {
|
package = mkPackageOption pkgs "1Password GUI" {
|
||||||
type = types.package;
|
default = [ "_1password-gui" ];
|
||||||
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.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config =
|
||||||
|
let
|
||||||
package = cfg.package.override {
|
package = cfg.package.override {
|
||||||
polkitPolicyOwners = cfg.polkitPolicyOwners;
|
polkitPolicyOwners = cfg.polkitPolicyOwners;
|
||||||
};
|
};
|
||||||
in mkIf cfg.enable {
|
in
|
||||||
|
mkIf cfg.enable {
|
||||||
environment.systemPackages = [ package ];
|
environment.systemPackages = [ package ];
|
||||||
users.groups.onepassword.gid = cfg.groupId;
|
users.groups.onepassword.gid = cfg.gid;
|
||||||
|
|
||||||
security.wrappers = {
|
security.wrappers = {
|
||||||
"1Password-BrowserSupport" =
|
"1Password-BrowserSupport" = {
|
||||||
{ source = "${cfg.package}/share/1password/1Password-BrowserSupport";
|
source = "${package}/share/1password/1Password-BrowserSupport";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "onepassword";
|
group = "onepassword";
|
||||||
setuid = false;
|
setuid = false;
|
||||||
setgid = true;
|
setgid = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
"1Password-KeyringHelper" =
|
"1Password-KeyringHelper" = {
|
||||||
{ source = "${cfg.package}/share/1password/1Password-KeyringHelper";
|
source = "${package}/share/1password/1Password-KeyringHelper";
|
||||||
owner = "root";
|
owner = "root";
|
||||||
group = "onepassword";
|
group = "onepassword";
|
||||||
setuid = true;
|
setuid = true;
|
||||||
|
|
|
@ -3,35 +3,33 @@
|
||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
cfg = config.programs._1password;
|
cfg = config.programs._1password;
|
||||||
in {
|
|
||||||
|
in
|
||||||
|
{
|
||||||
options = {
|
options = {
|
||||||
programs._1password = {
|
programs._1password = {
|
||||||
enable = mkEnableOption "The 1Password CLI tool with biometric unlock and integration with the 1Password GUI.";
|
enable = mkEnableOption "the 1Password CLI tool";
|
||||||
|
|
||||||
groupId = mkOption {
|
gid = mkOption {
|
||||||
type = types.int;
|
type = types.addCheck types.int (x: x >= 1000);
|
||||||
example = literalExpression "5001";
|
example = literalExpression "5001";
|
||||||
description = ''
|
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.
|
The gid to assign to the onepassword-cli group, which is needed for integration with the 1Password GUI.
|
||||||
|
It must be 1000 or greater.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
package = mkOption {
|
package = mkPackageOption pkgs "1Password CLI" {
|
||||||
type = types.package;
|
default = [ "_1password" ];
|
||||||
default = pkgs._1password;
|
|
||||||
defaultText = literalExpression "pkgs._1password";
|
|
||||||
example = literalExpression "pkgs._1password";
|
|
||||||
description = ''
|
|
||||||
The 1Password CLI derivation to use.
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
environment.systemPackages = [ cfg.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
users.groups.onepassword-cli.gid = cfg.groupId;
|
users.groups.onepassword-cli.gid = cfg.gid;
|
||||||
|
|
||||||
security.wrappers = {
|
security.wrappers = {
|
||||||
"op" = {
|
"op" = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue