Skip to content

Commit c62a314

Browse files
committed
fix: Only create darwin examples for hypervisors that work on macOS
Most hypervisors (firecracker, cloud-hypervisor, crosvm, kvmtool, stratovirt, alioth) require Linux KVM and cannot run on macOS. Only qemu (via Apple's HVF) and vfkit work on darwin, so only create example configurations for these two hypervisors on darwin systems. This removes 24 misleading example configurations that could be built but never run on macOS: - aarch64-darwin-{alioth,cloud-hypervisor,crosvm,firecracker,kvmtool,stratovirt}-* - x86_64-darwin-{alioth,cloud-hypervisor,crosvm,firecracker,kvmtool,stratovirt}-* Net result: - Added: 2 vfkit examples (aarch64-darwin, x86_64-darwin) - Removed: 24 KVM-only darwin examples - Kept: All Linux examples + qemu darwin examples (HVF)
1 parent 6904c56 commit c62a314

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flake.nix

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@
167167
];
168168
hypervisorsWithUserNet = [ "qemu" "kvmtool" "vfkit" ];
169169
hypervisorsDarwinOnly = [ "vfkit" ];
170+
# Hypervisors that work on darwin (qemu via HVF, vfkit natively)
171+
hypervisorsOnDarwin = [ "qemu" "vfkit" ];
170172
hypervisorsWithTap = builtins.filter
171173
# vfkit supports networking, but does not support tap
172174
(hv: hv != "vfkit")
@@ -175,8 +177,9 @@
175177
isDarwinOnly = hypervisor: builtins.elem hypervisor hypervisorsDarwinOnly;
176178
isDarwinSystem = system: lib.hasSuffix "-darwin" system;
177179
hypervisorSupportsSystem = hypervisor: system:
178-
# Darwin-only hypervisors only work on darwin, others work everywhere
179-
!(isDarwinOnly hypervisor && !(isDarwinSystem system));
180+
if isDarwinSystem system
181+
then builtins.elem hypervisor hypervisorsOnDarwin
182+
else !(isDarwinOnly hypervisor);
180183

181184
makeExample = { system, hypervisor, config ? {} }:
182185
lib.nixosSystem {

0 commit comments

Comments
 (0)