-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nixos/gnupg: add pinentry to systemPackages #90214
Conversation
I've encountered a related issue once where I wanted to be able to have 3 different types of environment.extraSetup = ''
ln -s ${pkgs.pinentry-gtk2}/bin/pinentry $out/bin/pinentry-gtk-2
ln -s ${pkgs.pinentry-curses}/bin/pinentry $out/bin/pinentry-curses
ln -s ${pkgs.pinentry}/bin/pinentry $out/bin/pinentry-tty
ln -s $out/bin/pinentry-tty $out/bin/pinentry
''; |
nixos/modules/programs/gnupg.nix
Outdated
@@ -123,7 +123,7 @@ in | |||
|
|||
services.dbus.packages = mkIf (cfg.agent.pinentryFlavor == "gnome3") [ pkgs.gcr ]; | |||
|
|||
environment.systemPackages = with pkgs; [ cfg.package ]; | |||
environment.systemPackages = with pkgs; [ cfg.package pinentry ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we install the proper pinentry package (i.e. qt, gtk or curses flavour)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really sure how to implement that logic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about solving it just like it's done here:
nixpkgs/nixos/modules/programs/gnupg.nix
Lines 97 to 102 in 7e9b156
systemd.user.services.gpg-agent = mkIf (cfg.agent.pinentryFlavor != null) { | |
serviceConfig.ExecStart = [ "" '' | |
${cfg.package}/bin/gpg-agent --supervised \ | |
--pinentry-program ${pkgs.pinentry.${cfg.agent.pinentryFlavor}}/bin/pinentry | |
'' ]; | |
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's constructing a path, I don't think I can put just a path as an item to: environment.systemPackages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm talking about adding pinentry.${cfg.agent.pinentryFlavor}
to systemPackages
. The pinentry
-package as an output for each flavor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, interesting. I misread that line, though it was "${pkgs.pinentry}.${cfg.agent.pinentryFlavor}", as that's more common
d9e5558
to
e9e7886
Compare
Would just adding a pinentry to There were suggestions to add a script to Edit: See #73332 (comment) |
I haven't yet tried out, but I could imagine the following might work in more environments and usecases:
That way, it should again become possible to configure the pinentry program via It might also fix some nix-on-non-NixOS usecases, once changes have trickled into the home-manager module. I'll try things out and will send a PR. |
So, I did do some digging, and it seems gnupg defaults to On the topic of falling back to ncurses if you're connecting via ssh (as #73332 (comment) seems to suggest): I see there's some ncurses fallback code on some graphical pinentries. However, this seems to not be working in all cases (for example I assume adding more generic support for these things into the graphical pinentries should be a good thing, and could improve the situation a lot. There's also |
I made the PR because someone on discord had trouble with the service, and thought it would be an easy enough fix to just include the command on the system PATH. I'm going to transfer this to an issue, and close the PR. I don't have enough familiarity to know a good path forward, if someone else would like to solve the usability issue, then they can do so in a different PR. |
Motivation for this change
This is needed at runtime:
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)