From e312a8ef64cce20bf68c6bbd661187fada5fc580 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 2 Apr 2007 15:01:09 +0000 Subject: [PATCH] * Start the SSH agent on X11 login. svn path=/nixos/trunk/; revision=8531 --- system/options.nix | 12 ++++++++++++ upstart-jobs/default.nix | 3 ++- upstart-jobs/xserver.nix | 10 +++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/system/options.nix b/system/options.nix index cb1b4223901..2dfbca44e7e 100644 --- a/system/options.nix +++ b/system/options.nix @@ -569,6 +569,18 @@ } + { + name = ["services" "xserver" "startSSHAgent"]; + default = true; + description = " + Whether to start the SSH agent when you log in. The SSH agent + remembers private keys for you so that you don't have to type in + passphrases every time you make an SSH connection. Use + ssh-add to add a key to the agent. + "; + } + + { name = ["services" "httpd" "enable"]; default = false; diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index f844c1d6d7b..c677cc3edd8 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -134,7 +134,8 @@ import ../upstart-jobs/gather.nix { (import ../upstart-jobs/xserver.nix { inherit config; inherit (pkgs) stdenv writeText lib xterm slim xorg mesa - gnome compiz feh kdebase kdelibs xkeyboard_config; + gnome compiz feh kdebase kdelibs xkeyboard_config + openssh x11_ssh_askpass; fontDirectories = import ../system/fonts.nix {inherit pkgs;}; }) diff --git a/upstart-jobs/xserver.nix b/upstart-jobs/xserver.nix index 69f1d834c4e..a6c6f152b45 100644 --- a/upstart-jobs/xserver.nix +++ b/upstart-jobs/xserver.nix @@ -2,6 +2,7 @@ , compiz, feh , kdelibs, kdebase , xkeyboard_config +, openssh, x11_ssh_askpass , config @@ -89,10 +90,17 @@ let exec > $HOME/.Xerrors 2>&1 - # Load X defaults. + ### Load X defaults. if test -e ~/.Xdefaults; then ${xorg.xrdb}/bin/xrdb -merge ~/.Xdefaults fi + + + ${if getCfg "startSSHAgent" then " + ### Start the SSH agent. + export SSH_ASKPASS=${x11_ssh_askpass}/libexec/x11-ssh-askpass + eval $(${openssh}/bin/ssh-agent) + " else ""} ### Start a window manager.