Skip to content

VM tests for Archlinux - #589203

Open
RaitoBezarius wants to merge 6 commits into
NixOS:masterfrom
RaitoBezarius:image-test-step1
Open

RaitoBezarius wants to merge 6 commits into
NixOS:masterfrom
RaitoBezarius:image-test-step1

Conversation

@RaitoBezarius

Copy link
Copy Markdown
Member

For a long time, only NixOS benefited from the marvel that the test framework represent to all of us.

I recently got into a quick hobby called Lix and we have to maintain now installers for non-NixOS distributions, including non-Linux OSes.

Enter into Allison Karlitskaya's VM runner.

It boots a stock "cloud" image and drives it entirely from the outside
using:

  • systemd credentials over SMBIOS type 11 OEM strings (good)
  • boot completion arrives as a sd_notify message over AF_VSOCK (very good)
  • commands are run over SSH through a AF_VSOCK listener (incredible)

No need for any cloud-init, nor a guest agent, nor network. Just vanilla systemd.

Once you have this, we wrap it in a familiar API for test scripts to the NixOS test framework (but async!) and wrap it into familiar Nix code. And here you go, feeling at home like with NixOS modulo provisioning.

This was successfully tested on ~15 VM tests on Arch Linux for the Lix installer and helped me find a couple of bugs!

Limitations:

  • x86_64-only, requires a patch upstream (but easy to fix)
  • Linux only, I have an upcoming PR based on @booxter's work to extend it to Darwin via Tart :-).
  • Debian 13 won't work because they do not generate SSH host keys if you don't use cloud-init somehow (sad)

Things done

@RaitoBezarius
RaitoBezarius requested a review from Ma27 November 16, 2026 22:13

@nixpkgs-ci nixpkgs-ci Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to the documentation.

Follow the documentation style guide, especially:

  • Show, don’t tell. Start with a minimal working example. Explain after the code.
  • Avoid meta-commentary. Don’t write "This section explains how to…".
  • Use present tense, imperative mood, and active voice. For example: "Run the command," not "The user should run the following command."
  • Avoid vague references like "this" when the referent is unclear. Write "This command creates a folder," not "This will create a folder."
  • Be direct. Avoid "should", "might", "typically", and "usually".
  • Cut filler words like "simply", "just", "easily", and "basically". Use "to" instead of "in order to".

For larger changes, such as adding or removing whole sections, ask the NixOS documentation team for review.

@nixpkgs-ci
nixpkgs-ci Bot requested review from a team, GetPsyched, hsjobeki and philiptaron and removed request for a team November 16, 2026 22:20
@nixpkgs-ci nixpkgs-ci Bot added 8.has: package (new) This PR adds a new package 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 6.topic: python Python is a high-level, general-purpose programming language. 8.has: changelog This PR adds or changes release notes 6.topic: testing Tooling for automated testing of packages and modules 8.has: documentation This PR adds or changes documentation labels Nov 16, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested a review from a team November 16, 2026 22:26
This is Allison Karlitskaya's VM runner.
https://cfp.all-systems-go.io/all-systems-go-2025/talk/MLTTHW/

It boots a stock "cloud" image and drives it entirely from the outside
using:

- systemd credentials over SMBIOS type 11 OEM strings
- boot completion arrives as a sd_notify message over AF_VSOCK
- commands are run over SSH through a AF_VSOCK listener

There's no cloud-init, no guest agent, no network configuration required
in the guest. Vanilla systemd.

The Lix project is planning to use it to improve testing on non-NixOS
distribution and present this as an alternative model for VM test
frameworks than the NixOS's one.

Classical packaging cleanups: FHS paths, upstream test suite using the
network.

The vendored workarounds and the VM Image API document are installed as
package data.

Once I have some time, I will try to talk with upstream to clean this
further.
@tfc

tfc commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

cc @kmein @jfly

@tfc

tfc commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Hi @RaitoBezarius, really nice to see this, testing installers on non-NixOS distros has been missing for a long time!

We've been working (@kmein did most of it) on something closely related that might be useful to you: https://github.com/applicative-systems/nix-and-match

Instead of a new tester, it plugs into runNixOSTest: non-NixOS VMs (cloud images, booted via cloud-init) become nodes on the same test network as NixOS VMs, with addresses and hosts entries like any other node, and the usual sync driver API (succeed, wait_for_unit, subtest, interactive driver, …).
That makes it easy to have, e.g., a NixOS node act as a mirror, binary cache or remote builder for the foreign machines.
It currently runs on 16 distros (Debian, Ubuntu, Fedora, Arch, Alma, Rocky, Oracle, openSUSE, Amazon) plus Talos.

As an example, I added Lix installer tests: https://github.com/applicative-systems/nix-and-match/tree/main/examples/lix-on-distros
They run the curl … | sh -s -- install one-liner unchanged against a NixOS node that impersonates install.lix.systems and releases.lix.systems, then build, build remotely, substitute from a cache, reboot and uninstall. A second check runs the installer's own cure-self cases. (don't look too closely, i obviously vibe coded it for demonstration purposes. i am sure real lix developers would test it much better and more thorough)
On all 16 distros, everything works (except two things, which look like installer bugs but i am not sure).

Your approach has things ours doesn't: no cloud-init and nothing installed in the guest, SSH over vsock instead of a serial shell, and a path to Darwin.
I think the two fit together well, e.g. vsock/SSH as a second way to reach foreign machines inside the existing driver, which already has vsock support for sshBackdoor. Then image tests could mix both kinds of machines with NixOS nodes.
I'd be glad to help work on that, whatever direction you prefer. Let me know what you think!

@Ma27 Ma27 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty cool to see this being moved forward. Especially with a relatively familiar UI.

I haven't given this a deeply thorough review, but reading over how it's structured this looks pretty sensible to me.

While we've chatted yesterday on this already, I guess it makes sense to summarize my general stance here I came to the conclusion that developing this outside the test driver is sensible for now We've had a large influx of nice features, but I feel like it's getting time to consolidate & clean up: non-exhaustive list, but

  • the machine consolidation here seems pretty useful for when we need to expand scope, so we might work towards that
  • the qemu-vm wrapper is a grown shell script that requires cleanup, I started this by porting the virtiofsd job-contro stuff to async python.
  • I'm very intrigued by an async core, both the way we can implement timesout, but also to replace most of our "management" threads that are essentially watching subprocesses. I even have ideas for keeping backwards comapt with the current testScript to not have an insane migration path.
  • Look into (finally) replacing the backdoor.

So yeah long story short I think it doesn't hurt to have its own codebase for this for the time being as something experimental or using the extensionn points of the test driver as @tfc does.

@philiptaron

Copy link
Copy Markdown
Contributor

So yeah long story short I think it doesn't hurt to have its own codebase for this for the time being as something experimental or using the extensionn points of the test driver as @tfc does.

If it'd be helpful, I'd be happy to help set up a NixOS/ repo for that with my GitHub org owner hat on.

commands are run over SSH through a AF_VSOCK listener (incredible)

amazing, love it a lot

@RaitoBezarius

Copy link
Copy Markdown
Member Author

Hi @RaitoBezarius, really nice to see this, testing installers on non-NixOS distros has been missing for a long time!

We've been working (@kmein did most of it) on something closely related that might be useful to you: applicative-systems/nix-and-match

Instead of a new tester, it plugs into runNixOSTest: non-NixOS VMs (cloud images, booted via cloud-init) become nodes on the same test network as NixOS VMs, with addresses and hosts entries like any other node, and the usual sync driver API (succeed, wait_for_unit, subtest, interactive driver, …). That makes it easy to have, e.g., a NixOS node act as a mirror, binary cache or remote builder for the foreign machines. It currently runs on 16 distros (Debian, Ubuntu, Fedora, Arch, Alma, Rocky, Oracle, openSUSE, Amazon) plus Talos.

As an example, I added Lix installer tests: applicative-systems/nix-and-match@main/examples/lix-on-distros They run the curl … | sh -s -- install one-liner unchanged against a NixOS node that impersonates install.lix.systems and releases.lix.systems, then build, build remotely, substitute from a cache, reboot and uninstall. A second check runs the installer's own cure-self cases. (don't look too closely, i obviously vibe coded it for demonstration purposes. i am sure real lix developers would test it much better and more thorough) On all 16 distros, everything works (except two things, which look like installer bugs but i am not sure).

Your approach has things ours doesn't: no cloud-init and nothing installed in the guest, SSH over vsock instead of a serial shell, and a path to Darwin. I think the two fit together well, e.g. vsock/SSH as a second way to reach foreign machines inside the existing driver, which already has vsock support for sshBackdoor. Then image tests could mix both kinds of machines with NixOS nodes. I'd be glad to help work on that, whatever direction you prefer. Let me know what you think!

Hi tfc, great work here but I don't think it's a good idea to tie this together to the existing test driver. It suffers from a lot of technical debt and accumulation of a rich feature set. I'm more interested into taking a step aside and build an alternative driver that can learn the lessons from the original test driver and supersede it at some point.

The original test driver has some severe shortcomings that are causing a lot of issues for my usage under heavy load usage and fixing them without breaking the backward compatibility is hard.

If you think that having non-NixOS support in the original test driver is a good idea, feel free, but for the reasons I mentioned, I think it's a dead end. It would be better architecturally wise to start from a blank canvas and take a look at what people wants to do with the test driver and design it from there.

I'm already in collaboration with @Ma27 on a couple of these ideas and promised Allison I would make something out of this for the NixOS space already 2 years ago: we can set up a more specific room on the AFNix Zulip on this topic if you are interested.

So yeah long story short I think it doesn't hurt to have its own codebase for this for the time being as something experimental or using the extensionn points of the test driver as @tfc does.

If it'd be helpful, I'd be happy to help set up a NixOS/ repo for that with my GitHub org owner hat on.

Thank you for the support but I'd like to keep it in the monorepo as it's easier. If we want to publish it separately, we could set up monorepo exports systems but otherwise I think I'm completely fine developing it in-tree.

If we wanted to have another tree, I would prefer something that is not GitHub because GitHub is painful these days but I do not see the need for it atm.

@tfc

tfc commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

[...] the existing test driver. It suffers from a lot of technical debt and accumulation of a rich feature set. I'm more interested into taking a step aside and build an alternative driver that can learn the lessons from the original test driver and supersede it at some point.

This sounds very black-or-white, but i share this sentiment to some extent. In the past it has not been easy to drop baggage and we're constantly (politely) defending against new features that are overly specialized. At the same time so many companies depend on the test driver, so it's not easy to really rethink stuff without breaking a lot.

I am interested to be in the loop on new developments, of course. Thank you for mentioning the zulip thing - how to join? did not find a way after looking right now tried signing up but it somehow does not work. where can i ask for support?

@thadguidry

thadguidry commented Nov 29, 2026 •

Copy link
Copy Markdown

What would be better or worse, if we switched to Incus (the fork of LXD) which can manage VMs and Containers in a more secure, feature rich way? Networking, Devices, Storage, etc. become easier to provision across VMs and Containers and could then later pull in Services.

Incus (LXD) removes the pain of mapping and config if you take a look. Easy command structure thats perfect to be wrapped if need be.

The other thing I'm thinking, is that by using Incus it might help towards better integration with Docker.sbx as it matures.

Thoughts?

@RaitoBezarius

Copy link
Copy Markdown
Member Author

[...] the existing test driver. It suffers from a lot of technical debt and accumulation of a rich feature set. I'm more interested into taking a step aside and build an alternative driver that can learn the lessons from the original test driver and supersede it at some point.

This sounds very black-or-white, but i share this sentiment to some extent. In the past it has not been easy to drop baggage and we're constantly (politely) defending against new features that are overly specialized. At the same time so many companies depend on the test driver, so it's not easy to really rethink stuff without breaking a lot.

Don't get me wrong, I know there's a lot to salvage and we have worked on it in the past as you know. The cost / benefit ratio is not really good I feel like.

I am interested to be in the loop on new developments, of course. Thank you for mentioning the zulip thing - how to join? did not find a way after looking right now tried signing up but it somehow does not work. where can i ask for support?

I will ask to fix that, please wait for news early next week.

What would be better or worse, if we switched to Incus (the fork of LXD) which can manage VMs and Containers in a more secure, feature rich way? Networking, Devices, Storage, etc. become easier to provision across VMs and Containers and could then later pull in Services.

Incus (LXD) removes the pain of mapping and config if you take a look. Easy command structure thats perfect to be wrapped if need be.

The other thing I'm thinking, is that by using Incus it might help towards better integration with Docker.sbx as it matures.

Thoughts?

What would be the purpose of integrating with Docker.sbx? I'm not sure I understand fully the motivations of reusing Incus which is a great piece of software but is oriented towards production workloads and this is a test driver. How do you tie those two together?

@thadguidry

thadguidry commented Nov 29, 2026 •

Copy link
Copy Markdown

What would be the purpose of integrating with Docker.sbx? I'm not sure I understand fully the motivations of reusing Incus which is a great piece of software but is oriented towards production workloads and this is a test driver. How do you tie those two together?

A few things that are problematic currently and Docker.sbx helping, with/without Incus:

  1. I dont see a path for providing isolated sandboxes for tests were my AI agents can run tests and use an MCP, while having granular control over networking and filesystems.
  2. Keeping the test driver sandbox, say Docker.sbx, and moving it from a local dev path into the final cloud environment, while preserving the filesystem.
  3. Defining my credentials, network rules I need for certain tests across VMs and Container clusters.
  4. Docker.sbx gives me a further security boundary when we run untrusted packages and testing them with/without AI agents.

Incus is an easier path for defining the host VMs (running many Docker.sbx's) and containers (running apps or services needed for tests). And defining the custom networks needed to tie them together. The host VMs and Containers sometimes run proprietary hardware through passthrough.

Does that help?

@RaitoBezarius

Copy link
Copy Markdown
Member Author

What would be the purpose of integrating with Docker.sbx? I'm not sure I understand fully the motivations of reusing Incus which is a great piece of software but is oriented towards production workloads and this is a test driver. How do you tie those two together?

A few things that are problematic currently and Docker.sbx helping, with/without Incus:

  1. I dont see a path for providing isolated sandboxes for tests were my AI agents can run tests and use an MCP, while having granular control over networking and filesystems.

I don't get it, your AI agents can simply use nix-build and it does sandboxing? Could you be more precise in what are the limits you have encountered?

  1. Keeping the test driver sandbox, say Docker.sbx, and moving it from a local dev path into the final cloud environment, while preserving the filesystem.

Why is it a goal?

  1. Defining my credentials, network rules I need for certain tests across VMs and Container clusters.

This is not related to VM testing anymore, right?

  1. Docker.sbx gives me a further security boundary when we run untrusted packages and testing them with/without AI agents.

OK but you can run Nix inside Docker.sbx for that, no?

Incus is an easier path for defining the host VMs (running many Docker.sbx's) and containers (running apps or services needed for tests). And defining yhe custom networks needed to tie them together. The host VMs and Containers sometimes run proprietary hardware through passthrough.

Does that help?

I'm still not sure where you want to go with all of that, I feel like there's a mixup between isolation goals at the Nix level, VM testing and production VMs? Could you perhaps open an issue with more details?

This is the driver behind the future `testers.runImageTest`.
It boots a virtual machine image and drives it from the outside, which
is what you need to test a distribution image.

This is not NixOS, so there's no module system to provision the target
system, no serial console shell to scrape and the image may not even run
bash as /bin/sh :-).

The whole API is async, because `test.thing` is async and async APIs are
increasingly a good choice for these things.

A side effect worth mentioning: because the script is a coroutine body,
`asyncio.timeout` gives us the global test deadline instead of what the
sync driver in NixOS does.

The logger, the exception types and the duration coercion are imported
from `nixos-test-driver` rather than copied. They are not specific to
NixOS machines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 6.topic: testing Tooling for automated testing of packages and modules 8.has: changelog This PR adds or changes release notes 8.has: documentation This PR adds or changes documentation 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants