Help with pinentryPackage

In my configuration.nix I used

programs.gnupg.agent = {
    enable = true;
    pinentryFlavor = "qt";
  };

but, I got this error
error:
Failed assertions:
- The option definition programs.gnupg.agent.pinentryFlavor' in /etc/nixos/configuration.nix’ no longer has any effect; please remove it.
Use programs.gnupg.agent.pinentryPackage instead
I then tried using

programs.gnupg.agent = {
    enable = true;
    pinentryPackage = pkgs.pinentry-qt;
  };

But this also didn’t work.
What are the types that pinentryPackage takes?

What happened when you changed it? What was the error. That value should have worked.

The error I got when I changed it was this.

error: The option `programs.gnupg.agent.pinentryPackage' is defined multiple times while it's expected to be unique.

       Definition values:
       - In `/etc/nixos/configuration.nix': <derivation pinentry-qt-1.2.1>
       - In `/nix/store/57baa94f2z0xrm7hfwybkiph87dwcq5s-nixos/nixos/nixos/modules/services/desktop-managers/plasma6.nix': <derivation pinentry-qt-1.2.1>
       Use `lib.mkForce value` or `lib.mkDefault value` to change the priority on any of these definitions.

Hmm, it’s kind of weird that it’s complaining because those seem like they’re the same value. You can probably just remove the entry in configuration.nix.

Or if for some reason they’re actually different and it needs to be the one you have there, use lib.mkForce like it suggests to make configuration.nix win.

I’ll try commenting it out and see if the package is included with kde plasma6 by default.
Thank you for your help.

Can confirm that using just enable defaults to correct package.

This change seems to reveal some other issues as well. I received some other collision error because of xserver enabled and swaywm in parallel, both setting the gpg agent package now.

If you run into this you can just do

programs.gnupg.agent = {
    enable = true;
    pinentryPackage = lib.mkForce pkgs.pinentry-qt;
  };

or similar

This particular case will be fixed with https://nixpk.gs/pr-tracker.html?pr=296866 . The problem remains when enabling multiple window managers, though.

If I understand correctly the pinentry program must be configured globally, so if you have multiple window managers enabled that suggest different pinentry programs you’ll have to specify the one you want yourself with something like programs.gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3.

1 Like