Skip to content

Run NixOS tests on Darwin #64578

@nmattia

Description

@nmattia

Issue description

It would be great to be able to run NixOS tests on Darwin. Right now building/running NixOS tests fails on Darwin when building the Linux VMs.

If one has a Linux builder available, it should be possible to:

  1. Build the Linux VMs on the Linux builder.
  2. Run the tests on Darwin as well as running the start scripts (for interacting with the VMs locally) using hvf instead of KVM.

My interpretation is that build-vms.nix should be tweaked. buildVM should take a Linux package set (pkgs with system = "...-linux"), and the rest of the build (driver, buildVirtualNetwork) should take a Darwin package set.

buildVM =
nodes: configurations:
import ./eval-config.nix {
inherit system;
modules = configurations ++ extraConfigurations;
baseModules = (import ../modules/module-list.nix) ++
[ ../modules/virtualisation/qemu-vm.nix
../modules/testing/test-instrumentation.nix # !!! should only get added for automated test runs
{ key = "no-manual"; documentation.nixos.enable = false; }
{ key = "qemu"; system.build.qemu = qemu; }
{ key = "nodes"; _module.args.nodes = nodes; }
] ++ optional minimal ../modules/testing/minimal-kernel.nix;
};

Then the qemu commands should be changed to use accel=hvf (instead of =kvm) on Darwin.

CC @basvandijk

Metadata

Metadata

Assignees

No one assigned

    Labels

    6.topic: darwinRunning or building packages on Darwin6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS6.topic: testingTooling for automated testing of packages and modules

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions