1
0
mirror of https://github.com/nix-community/home-manager synced 2024-06-23 15:08:31 +02:00

ssh-agent: init module (#4178)

This commit is contained in:
Linus Heckemann 2023-06-28 23:58:15 +02:00 committed by Sumner Evans
parent 7a0e9a6782
commit 2d9210f25e
No known key found for this signature in database
GPG Key ID: 8904527AB50022FD
3 changed files with 45 additions and 0 deletions

View File

@ -1135,6 +1135,14 @@ in
A new modules is available: 'programs.zsh.antidote'
'';
}
{
time = "2023-06-30T14:46:22+00:00";
condition = config.services.ssh-agent.enable;
message = ''
A new module is available: 'services.ssh-agent'
'';
}
];
};
}

View File

@ -306,6 +306,7 @@ let
./services/screen-locker.nix
./services/sctd.nix
./services/spotifyd.nix
./services/ssh-agent.nix
./services/stalonetray.nix
./services/status-notifier-watcher.nix
./services/swayidle.nix

View File

@ -0,0 +1,36 @@
{ config, options, lib, pkgs, ... }:
let
cfg = config.services.ssh-agent;
in {
meta.maintainers = [ lib.maintainers.lheckemann ];
options = {
services.ssh-agent = {
enable = lib.mkEnableOption "OpenSSH private key agent";
};
};
config = lib.mkIf cfg.enable {
home.sessionVariablesExtra = ''
if [[ -z "$SSH_AUTH_SOCK" ]]; then
export SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/ssh-agent
fi
'';
systemd.user.services.ssh-agent = {
Install.WantedBy = [ "default.target" ];
Unit = {
Description = "SSH authentication agent";
Documentation = "man:ssh-agent(1)";
};
Service = {
ExecStart = "${pkgs.openssh}/bin/ssh-agent -D -a %t/ssh-agent";
};
};
};
}