1
0
Fork 0

Add ssh-agent

This commit is contained in:
Malte Brandy 2018-06-30 04:26:24 +02:00
parent e19daadc9d
commit f6c633c598
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
2 changed files with 21 additions and 1 deletions

View file

@ -7,6 +7,7 @@ options.m-0.graphical.enable = mkEnableOption "Window Manager";
imports = [
./i3.nix
./rofi
./ssh-agent.nix
];
config = mkIf config.m-0.graphical.enable {
@ -87,7 +88,6 @@ config = mkIf config.m-0.graphical.enable {
};
gpg-agent = {
enable = true;
enableSshSupport = true;
defaultCacheTtl = 900;
defaultCacheTtlSsh = 900;
};

View file

@ -0,0 +1,20 @@
{ pkgs , config , lib, ... }:
with lib; {
config = mkIf config.m-0.graphical.enable {
xsession.initExtra = let
cat-pw = pkgs.writeShellScriptBin "cat-ssh-pw" ''
pass eu/m-0/${config.m-0.hostName}/ssh
'';
start-agent = pkgs.writeShellScriptBin "start-ssh-agent" ''
${pkgs.psmisc}/bin/killall -q ssh-agent
eval `${pkgs.openssh}/bin/ssh-agent -s`
systemctl --user set-environment SSH_AUTH_SOCK="$SSH_AUTH_SOCK"
systemctl --user set-environment SSH_AGENT_PID="$SSH_AGENT_PID"
SSH_ASKPASS=${cat-pw}/bin/cat-ssh-pw ${pkgs.openssh}/bin/ssh-add < /dev/null
'';
in
". ${start-agent}/bin/start-ssh-agent";
};
}