rbw: simplify 'pinentry' type

Following some upstream changes [1], it's now possible to use a simplified
package type for the option.

[1]: https://github.com/NixOS/nixpkgs/pull/133542
This commit is contained in:
Bruno BELANYI 2024-03-10 10:24:45 +00:00 committed by Robert Helgesson
parent 01e4a5143e
commit 1ab3cec3a1
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
5 changed files with 19 additions and 20 deletions

View file

@ -1452,6 +1452,15 @@ in {
'services.gpg-agent.pinentryPackage'. 'services.gpg-agent.pinentryPackage'.
''; '';
} }
{
time = "2024-03-14T07:22:59+00:00";
condition = config.programs.rbw.enable;
message = ''
'programs.rbw.pinentry' has been simplified to only accept 'null' or
a package.
'';
}
]; ];
}; };
} }

View file

@ -41,9 +41,9 @@ let
}; };
pinentry = mkOption { pinentry = mkOption {
type = with types; either package (enum pkgs.pinentry.flavors); type = types.nullOr types.package;
example = "gnome3"; example = literalExpression "pkgs.pinentry-gnome3";
default = "gtk2"; default = null;
description = '' description = ''
Which pinentry interface to use. Beware that Which pinentry interface to use. Beware that
`pinentry-gnome3` may not work on non-Gnome `pinentry-gnome3` may not work on non-Gnome
@ -52,15 +52,9 @@ let
```nix ```nix
services.dbus.packages = [ pkgs.gcr ]; services.dbus.packages = [ pkgs.gcr ];
``` ```
For this reason, the default is `gtk2` for
now.
''; '';
# we want the program in the config # we want the program in the config
apply = val: apply = val: if val == null then val else lib.getExe val;
if builtins.isString val then
"${pkgs.pinentry.${val}}/bin/pinentry"
else
"${val}/${val.binaryPath or "bin/pinentry"}";
}; };
}; };
}; };
@ -87,7 +81,7 @@ in {
{ {
email = "name@example.com"; email = "name@example.com";
lock_timeout = 300; lock_timeout = 300;
pinentry = "gnome3"; pinentry = pkgs.pinentry-gnome3;
} }
''; '';
description = '' description = ''

View file

@ -5,12 +5,8 @@
nixpkgs.overlays = [ nixpkgs.overlays = [
(self: super: { (self: super: {
pinentry = { pinentry-gnome3 =
gnome3 =
config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; }; config.lib.test.mkStubPackage { outPath = "@pinentry-gnome3@"; };
gtk2 = config.lib.test.mkStubPackage { outPath = "@pinentry-gtk2@"; };
flavors = [ "gnome3" "gtk2" ];
};
}) })
]; ];
} }

View file

@ -14,7 +14,7 @@ let
"email": "name@example.com", "email": "name@example.com",
"identity_url": "identity.example.com", "identity_url": "identity.example.com",
"lock_timeout": 300, "lock_timeout": 300,
"pinentry": "@pinentry-gnome3@/bin/pinentry" "pinentry": "@pinentry-gnome3@/bin/dummy"
} }
''; '';
in { in {
@ -27,7 +27,7 @@ in {
base_url = "bitwarden.example.com"; base_url = "bitwarden.example.com";
identity_url = "identity.example.com"; identity_url = "identity.example.com";
lock_timeout = 300; lock_timeout = 300;
pinentry = "gnome3"; pinentry = pkgs.pinentry-gnome3;
}; };
}; };

View file

@ -14,7 +14,7 @@ let
"email": "name@example.com", "email": "name@example.com",
"identity_url": null, "identity_url": null,
"lock_timeout": 3600, "lock_timeout": 3600,
"pinentry": "@pinentry-gtk2@/bin/pinentry" "pinentry": null
} }
''; '';
in { in {