Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions nixos/modules/security/ssh-agent.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
let
cfg = config.security.SSHAgent;
in {

options = {
security.SSHAgent = {
socket = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "The path to the SSH agent socket";
};
};
};


config = lib.mkIf cfg.socket != null {
environment.extraInit = ''
if [ -z "$SSH_AUTH_SOCK" -a -n "$XDG_RUNTIME_DIR" ]; then
export SSH_AUTH_SOCK=${cfg.socket}
fi
'';
};


}
10 changes: 8 additions & 2 deletions nixos/modules/services/desktops/gnome/gnome-keyring.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# GNOME Keyring daemon.

{ config, pkgs, lib, ... }:

let
cfg = config.services.gnome.gnome-keyring;
in
{

meta = {
Expand All @@ -24,14 +26,16 @@
'';
};

SSHSupport.enable = lib.mkEnableOption "SSH agent support for GNOME Keyring by setting the SSH_AUTH_SOCK environment variable";

};

};


###### implementation

config = lib.mkIf config.services.gnome.gnome-keyring.enable {
config = lib.mkIf cfg.enable {

environment.systemPackages = [ pkgs.gnome.gnome-keyring ];

Expand All @@ -48,6 +52,8 @@
source = "${pkgs.gnome.gnome-keyring}/bin/gnome-keyring-daemon";
};

security.SSHAgent.socket = lib.mkIf cfg.SSHSupport.enable "$XDG_RUNTIME_DIR/keyring/ssh";

};

}