1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-25 11:19:47 +01: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' 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/screen-locker.nix
./services/sctd.nix ./services/sctd.nix
./services/spotifyd.nix ./services/spotifyd.nix
./services/ssh-agent.nix
./services/stalonetray.nix ./services/stalonetray.nix
./services/status-notifier-watcher.nix ./services/status-notifier-watcher.nix
./services/swayidle.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";
};
};
};
}