mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 15:14:26 +00:00
ssh-agent: init module (#4178)
This commit is contained in:
parent
7a0e9a6782
commit
2d9210f25e
3 changed files with 45 additions and 0 deletions
|
@ -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'
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
36
modules/services/ssh-agent.nix
Normal file
36
modules/services/ssh-agent.nix
Normal 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue