Repository navigation
nixos/qemu-vm: restore 9p support for darwin; add darwin.linux-builder back to release blocker - #562444
Conversation
Keep virtiofs for linux, but use 9p otherwise. This restores darwin support - which is used both for `darwin.linux-builder` and `build-vm` nixpkgs VMs. This patch does not restore removed options: their utility is not immediately clear to me, and restoring the options would complicate the code for unclear gains. Hopefully, the reduced scope also makes it more palatable for maintainers to accept this functionality back in.
This reverts commit 342b435. Darwin support in qemu-vm.nix is restored and the qemu builder can, again, be evaluated.
Review dismissed automatically
|
Have you tried linux-builder-vz ? |
|
That requires nested virtualization to run NixOS tests, which is slow (at least on x86 - I confess I haven't tested it on Apple Silicon) and only available on recent hardware. FWIW I have used this functionality frequently with upstream NixOS tests while working on Nixpkgs contributions. |
|
IMO this doesn't belong in the qemu-vm module but in the Linux builder module. The only thing you seem to need is a shared directory for the keys. You can just add these via qemu.options there. I can look into it and prepare a patch but I cannot test it (which is one of the core issues here). This would also mean that it's easier to evolve the qemu-vm module without affecting the Linux builder in the future. |
|
@booxter thank you for this work and especially restoring nixos tests on the mac again. Would have hoped for this to happen in the PR that removed it, so extra-thanks for the effort! |
|
A change specific to the Linux builder wouldn't fix running NixOS tests or NixOS configuration VMs. It does seem better to keep the guest environment uniform across host platforms where possible - there's at least an attempt to port virtiofsd to macOS that could work - but the diff here doesn't seem like a major burden to fix a regression in an explicitly-documented feature that impacts people working with and on NixOS. Maybe @booxter would be willing to become a maintainer of the QEMU VM module to keep it working? |
|
yes I tried -vz. It's currently broken after gc: #557239 There are also kernel lockups that I hit with it (I reported a bug). It will probably take some time for it to mature. But also: I feel like folks don't know that nixos tests work on MacOS natively, and that's where 9p comes in. It's actually magic and a killer Nix* feature for developers on Darwin (which we have a lot in the industry overall). @emilazy I appreciate an attempt to nerd snipe me to implement virtiofsd (who knows, maybe it will work😄?) but we need the regression fixed today, not in a distant future. That's what this PR is doing, and for a very cheap price honestly. I'm happy to add myself to maintainers of the module if folks are fine with it: it's clear that the current team has its priorities elsewhere, so maybe having a Darwin voice on the list could help to catch such changes earlier. Personally I'm very much committed to maintain and improve both builder and nixos tests on Darwin and in general. |
That's true and fair but it also states that it needs some kind of remote builder:
And it's worth noting that make-disk-image (which is used in a large share of our tests) has been using virtiofs since December 2024 and thus has only been able to be used with nested virt on darwin. However, I think it's fine to go with this for now as a sort of stopgap solution. I do, however, also think that we have a too tight coupling here where the qemu-vm module tries to do too much and is thus very hard to evolve. Ideally we end up in a state where we have different backends that can be managed in a different lifecycle (e.g. one for Darwin & one for Linux). It's good to know that @booxter is comitted to help maintain this. Let me run the systemd tests really quick and then we can get this merged. |
nixpkgs 02f5696b breaks nix.linux-builder on aarch64-darwin: NixOS/nixpkgs#552774 switched qemu-vm from 9p to virtiofs, but virtiofsd doesn't support darwin. Fix (NixOS/nixpkgs#562444) isn't merged yet, so pin nixpkgs to aff8a0b (2026-09-10) until it lands. Co-Authored-By: Claude Sonnet 5 <[email protected]>
c96d269
FWIW this is true and not contradictory: you need a builder to build test VMs, but then you run the result natively on a local Darwin machine. That said, the wording can probably be more tight. I'll look into it. |
nixpkgs switched qemu-vm's sharedDirectories from 9p to virtiofs (NixOS/nixpkgs#552774), calling `hostPkgs.virtiofsd` unconditionally. virtiofsd is linux-only, so `nix.linux-builder.enable` stopped evaluating on aarch64-darwin: error: Refusing to evaluate package 'virtiofsd-1.14.0' ... because it is not available on the requested hostPlatform NixOS/nixpkgs#562444 keeps virtiofs for linux and falls back to 9p otherwise, restoring darwin.linux-builder. It landed in nixos-unstable after the rev this lock pinned.
Keep virtiofs for linux, but use 9p otherwise. This restores darwin support -
which is used both for
darwin.linux-builderandbuild-vmnixpkgs VMs.This patch does not restore removed options: their utility is not immediately
clear to me, and restoring the options would complicate the code for unclear
gains. Hopefully, the reduced scope also makes it more palatable for
maintainers to accept this functionality back in.
With this change, I can build
darwin.linux-builderand run NixOS tests again.This should not affect linux rebuilds, hence posting to master.Meh, there's a single newline change. Targeting to staging-nixos.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.