2025-01-16 04:37:09 +01:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
inputs,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (lib) types mkEnableOption mkIf;
|
|
|
|
inherit (lib.metacfg) mkOpt;
|
|
|
|
|
|
|
|
cfg = config.metacfg.security.ssh;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.metacfg.security.ssh = {
|
|
|
|
enable = mkEnableOption "SSH";
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = with pkgs; [ openssh ];
|
2025-01-16 09:06:46 +01:00
|
|
|
|
|
|
|
#environment.shellInit = ''
|
|
|
|
# export SSH_AUTH_SOCK="$HOME/.ssh/ssh-agent.sock"
|
|
|
|
#'';
|
|
|
|
|
2025-01-16 04:37:09 +01:00
|
|
|
launchd.user.agents.ssh-agent.serviceConfig = {
|
2025-01-16 09:06:46 +01:00
|
|
|
Label = "ssh-agent";
|
|
|
|
EnvironmentVariables.SSH_AUTH_SOCK = "/Users/${config.metacfg.user.name}/.ssh/ssh-agent.sock";
|
2025-01-16 04:37:09 +01:00
|
|
|
ProgramArguments = [
|
|
|
|
"${pkgs.openssh}/bin/ssh-agent"
|
2025-01-16 09:06:46 +01:00
|
|
|
"-a"
|
|
|
|
"/Users/${config.metacfg.user.name}/.ssh/ssh-agent.sock"
|
2025-01-16 04:37:09 +01:00
|
|
|
"-D"
|
|
|
|
];
|
|
|
|
RunAtLoad = true;
|
2025-01-16 09:06:46 +01:00
|
|
|
KeepAlive.SuccessfulExit = true;
|
2025-01-16 04:37:09 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|