uvms/profiles/vsock-connect-guest.nix

31 lines
786 B
Nix
Raw Normal View History

2025-09-17 16:51:24 +03:00
{
options,
config,
lib,
...
}:
let
mkIfGuest = import ../lib/mkIfMicrovmGuest.nix { inherit options config lib; };
in
{
config = lib.mkMerge [
(mkIfGuest {
2025-09-17 16:51:24 +03:00
microvm.cloud-hypervisor.extraArgs = [
"--vsock"
"cid=4,socket=vsock.sock"
2025-09-17 16:51:24 +03:00
];
})
{
2025-09-17 16:51:24 +03:00
# Somehow, sshd calls to PAM with PAM_RHOST="UNKNOWN",
# prompting a slow DNS look-up each time...
#
# https://mastodon.acm.org/@nobody/115108458851355328
# https://github.com/linux-pam/linux-pam/issues/885#issuecomment-3030698895
networking.hosts."100::" = [ "UNKNOWN" ];
boot.initrd.extraFiles = lib.optionalAttrs config.boot.initrd.network.ssh.enable {
"/etc/hosts" = { inherit (config.environment.etc.hosts) source; };
};
}
];
2025-09-17 16:51:24 +03:00
}