Files
vmimages/home-manager/ssh-proxy.nix
2023-11-29 21:08:18 +00:00

32 lines
802 B
Nix

{
lib,
pkgs,
config,
...
}:{
home.packages = with pkgs; [
npiperelay
socat
];
systemd.user = {
startServices = true;
services.ssh-proxy = {
Unit = {
Description = "WSL Proxy";
After = "sops-nix.service";
};
Install = {WantedBy = ["default.target"];};
Service = {
ExecStart = "${pkgs.writeShellScript "start-proxy" ''
set -x -o xtrace # print commands
${pkgs.coreutils}/bin/rm -f /home/sstent/.ssh/wsl-ssh-agent.sock
${pkgs.util-linux}/bin/setsid ${pkgs.socat}/bin/socat UNIX-LISTEN:/home/sstent/.ssh/wsl-ssh-agent.sock,fork EXEC:"${pkgs.npiperelay}/bin/npiperelay.exe -ei -s //./pipe/openssh-ssh-agent",nofork
''}";
};
};
};
}