gpg-agent: migrate to 'pinentryPackage'

This follows upstream's module change [1], which allows setting any
package as a pinentry program.

[1]: https://github.com/NixOS/nixpkgs/pull/133542
This commit is contained in:
Bruno BELANYI 2024-01-14 17:09:06 +00:00 committed by Robert Helgesson
parent 2f0db7d418
commit 01e4a5143e
No known key found for this signature in database
GPG Key ID: 96E745BD17AA17ED
4 changed files with 21 additions and 8 deletions

View File

@ -1443,6 +1443,15 @@ in {
A new module is available: 'programs.joplin-desktop'.
'';
}
{
time = "2024-03-14T07:22:09+00:00";
condition = config.services.gpg-agent.enable;
message = ''
'services.gpg-agent.pinentryFlavor' has been removed and replaced by
'services.gpg-agent.pinentryPackage'.
'';
}
];
};
}

View File

@ -81,6 +81,11 @@ let
in {
meta.maintainers = [ maintainers.rycee ];
imports = [
(mkRemovedOptionModule [ "services" "gpg-agent" "pinentryFlavor" ]
"Use services.gpg-agent.pinentryPackage instead")
];
options = {
services.gpg-agent = {
enable = mkEnableOption "GnuPG private key agent";
@ -192,10 +197,9 @@ in {
configuration file.
'';
};
pinentryFlavor = mkOption {
type = types.nullOr (types.enum pkgs.pinentry.flavors);
example = "gnome3";
pinentryPackage = mkOption {
type = types.nullOr types.package;
example = literalExpression "pkgs.pinentry-gnome3";
default = null;
description = ''
Which pinentry interface to use. If not
@ -243,8 +247,8 @@ in {
"max-cache-ttl ${toString cfg.maxCacheTtl}"
++ optional (cfg.maxCacheTtlSsh != null)
"max-cache-ttl-ssh ${toString cfg.maxCacheTtlSsh}"
++ optional (cfg.pinentryFlavor != null)
"pinentry-program ${pkgs.pinentry.${cfg.pinentryFlavor}}/bin/pinentry"
++ optional (cfg.pinentryPackage != null)
"pinentry-program ${lib.getExe pinentryPackage}"
++ [ cfg.extraConfig ]);
home.sessionVariablesExtra = optionalString cfg.enableSshSupport ''

View File

@ -5,7 +5,7 @@ with lib;
{
config = {
services.gpg-agent.enable = true;
services.gpg-agent.pinentryFlavor = null; # Don't build pinentry package.
services.gpg-agent.pinentryPackage = null; # Don't build pinentry package.
programs.gpg.enable = true;
test.stubs.gnupg = { };

View File

@ -5,7 +5,7 @@ with lib;
{
config = {
services.gpg-agent.enable = true;
services.gpg-agent.pinentryFlavor = null; # Don't build pinentry package.
services.gpg-agent.pinentryPackage = null; # Don't build pinentry package.
programs.gpg = {
enable = true;
homedir = "/path/to/hash";