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

View file

@ -5,7 +5,7 @@ with lib;
{ {
config = { config = {
services.gpg-agent.enable = true; 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; programs.gpg.enable = true;
test.stubs.gnupg = { }; test.stubs.gnupg = { };

View file

@ -5,7 +5,7 @@ with lib;
{ {
config = { config = {
services.gpg-agent.enable = true; 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 = { programs.gpg = {
enable = true; enable = true;
homedir = "/path/to/hash"; homedir = "/path/to/hash";