nixos/gnupg: fix gpg-agent when pinentryFlavor is null

8ea644997f moved the configuration outside
the pinentryFlavor check, causing evaluation to fail when it was set to
null.

960a5142aa removed the upstream systemd
units, causing gpg-agent.service to be conditional on pinentryFlavor.
This commit is contained in:
David McFarland 2023-06-30 08:04:14 -03:00
parent 3cf96bff20
commit 3d4f3068fd

View File

@ -94,12 +94,13 @@ in
};
config = mkIf cfg.agent.enable {
environment.etc."gnupg/gpg-agent.conf".text = ''
environment.etc."gnupg/gpg-agent.conf".text =
lib.optionalString (cfg.agent.pinentryFlavor != null) ''
pinentry-program ${pkgs.pinentry.${cfg.agent.pinentryFlavor}}/bin/pinentry
'';
# This overrides the systemd user unit shipped with the gnupg package
systemd.user.services.gpg-agent = mkIf (cfg.agent.pinentryFlavor != null) {
systemd.user.services.gpg-agent = {
unitConfig = {
Description = "GnuPG cryptographic agent and passphrase cache";
Documentation = "man:gpg-agent(1)";