nixos/gnome-keyring: add SSH support by exporting SSH_AUTH_SOCK#310978
nixos/gnome-keyring: add SSH support by exporting SSH_AUTH_SOCK#310978no-mood wants to merge 7 commits intoNixOS:masterfrom
Conversation
| source = "${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon"; | ||
| }; | ||
|
|
||
| environment.extraInit = lib.mkIf cfg.enableSSHSupport '' |
There was a problem hiding this comment.
Hmm. Is there no easy way to express this with environment.sessionVariables or environment.variables?
There was a problem hiding this comment.
At first I was trying to use something like this:
environment.sessionVariables = {
SSH_AUTH_SOCK = "${builtins.getEnv "XDG_RUNTIME_DIR"}/keyring/ssh";
};
Then I relied on what is done with SSH and GnuPG, I thought it was a better practice.
There was a problem hiding this comment.
This ${builtins.getEnv "XDG_RUNTIME_DIR"} is $XDG_RUNTIME_DIR in eval, not in activation.
The current way is not that bad though:
nixpkgs/nixos/modules/services/security/yubikey-agent.nix
Lines 48 to 52 in 8535fb9
|
I hadn't realized that in my configuration, the gnome-keyring-daemon is manually launched by my window manager (Hyprland): This means that exporting the There's a home-manager gnome-keyring module that does this in a similar way, but we're still missing a nixos module Update: These issues may be related; unfortunately, I just discovered them: |
|
The gnome keyring component for setting ssh is moved to gcr https://wiki.archlinux.org/title/GNOME/Keyring#Setup_gcr Seems like the systemd component is added to gcr So starting the service and setting SSH_AUTH_SOCK should do the trick? In theory |
|
There is another problem. SSH_AUTH_SOCK should be mutually exclusive in various modules to avoid undefined behavior. In the current implementation, they will not conflict with each other during eval. |
Something like this was added here: nixpkgs/nixos/modules/programs/gnupg.nix Lines 238 to 242 in 71bae31 I feel like we could use add another layer and make an option. Something like services.keyring = gnome-keyring
|
An option for setting |
I agree. Is this the right place for this or should I open a new issue? |
I think it's reasonable to add it in this PR and then change the title (therefore repurpose) the PR to reflect the change |
|
Before making a commit, the idea would be to add a level of abstraction and create an additional option that sets Example: The new option will be By creating this option, checking for other active SSH agents won't be needed. |
9da36e9 to
f61231c
Compare
f61231c to
cdb7ef7
Compare
cdb7ef7 to
f27533c
Compare
|
any progress on this? |
Description of changes
Added SSH support inside the gnome-keyring module, similar to ssh.nix and gnupg.nix by exporting
SSH_AUTH_SOCK.Things done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.