Add ssh-agent
This commit is contained in:
parent
e19daadc9d
commit
f6c633c598
|
@ -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;
|
||||
};
|
||||
|
|
20
home-manager/modules/graphical/ssh-agent.nix
Normal file
20
home-manager/modules/graphical/ssh-agent.nix
Normal 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";
|
||||
};
|
||||
|
||||
}
|
Loading…
Reference in a new issue