Skip to content

Commit 1f4177c

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 95a1204 commit 1f4177c

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
@@ -164,6 +164,8 @@
164164
];
165165
hypervisorsWithUserNet = [ "qemu" "kvmtool" "vfkit" ];
166166
hypervisorsDarwinOnly = [ "vfkit" ];
167+
# Hypervisors that work on darwin (qemu via HVF, vfkit natively)
168+
hypervisorsOnDarwin = [ "qemu" "vfkit" ];
167169
hypervisorsWithTap = builtins.filter
168170
# vfkit supports networking, but does not support tap
169171
(hv: hv != "vfkit")
@@ -172,8 +174,9 @@
172174
isDarwinOnly = hypervisor: builtins.elem hypervisor hypervisorsDarwinOnly;
173175
isDarwinSystem = system: nixpkgs.lib.hasSuffix "-darwin" system;
174176
hypervisorSupportsSystem = hypervisor: system:
175-
# Darwin-only hypervisors only work on darwin, others work everywhere
176-
!(isDarwinOnly hypervisor && !(isDarwinSystem system));
177+
if isDarwinSystem system
178+
then builtins.elem hypervisor hypervisorsOnDarwin
179+
else !(isDarwinOnly hypervisor);
177180

178181
makeExample = { system, hypervisor, config ? {} }:
179182
nixpkgs.lib.nixosSystem {

0 commit comments

Comments
 (0)