From c6e01cc83887313de6f5d4100b845aedf8ef7db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6gler?= Date: Sat, 11 Apr 2026 20:49:01 +0200 Subject: [PATCH] nixos/systemd: fix socket `sshd-vsock` --- nixos/modules/system/boot/systemd.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 8c2735c00b8c..2808a2ac4e21 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -886,6 +886,21 @@ in serviceConfig.ExecSearchPath = "${config.services.openssh.package}/bin"; overrideStrategy = "asDropin"; }; + + # Fix paths in sshd-vsock.socket + # https://github.com/systemd/systemd/blob/v259.3/src/ssh-generator/ssh-generator.c#L239 + # this socket is used, for example, when NixOS is started via systemd-vmspawn + systemd.sockets.sshd-vsock = mkIf config.services.openssh.enable { + overrideStrategy = "asDropin"; + socketConfig.ExecStartPost = [ + "" + "${config.systemd.package}/lib/systemd/systemd-ssh-issue --make-vsock" + ]; + socketConfig.ExecStopPre = [ + "" + "${config.systemd.package}/lib/systemd/systemd-ssh-issue --rm-vsock" + ]; + }; }; # FIXME: Remove these eventually.