GPG version warning when using gpg-agent from nixos but gnupg from user

I’m running nixOS, and my configuration has programs.gnupg.agent.enable = true;, which installed gnupg from the nixos channel (19.03) and starts it for each user that logs in.

However, my user’s profile is using the unstable channel. I’ve also installed gnupg there. Now every time I use it, I get this warning:

gpg: WARNING: server 'gpg-agent' is older than us ("version on nixos-19.03" < "version on nixos-unstable")

Is there a way to avoid this warning?

That module has the option programs.gnupg.package which you can use to override the package being used. Pointing that to the unstable version should work

Not in 19.03, unless I’m missing something.

Oh sorry, yeah it’s only in master/nixos-unstable as of now (programs.gnupg: Support setting the gnupg program by bkchr · Pull Request #57782 · NixOS/nixpkgs · GitHub).

What you could do instead is add disabledModules and imports to replace the gnupg module with the one on master/nixos-unstable:

{
  disabledModules = [ "programs/gnupg.nix" ];
  imports = [
    (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/d26027792812fbfad4d0f451b5f47fdabf7fdeb9"
      + "/nixos/modules/programs/gnupg.nix")
  ];

  programs.gnupg = {
    # ...
  };
}

untested, but something like this should work. You can also add a sha256 to the fetchTarball to have it not be downloaded (almost) every time

2 Likes

Thanks, that seems to work!