[PATCH 02/12] Kconfig: add QEMU_SYSTEM_UNITS as a new bringup method
Daniel Gomez <[email protected]> Thu, 23 Apr 2026 13:30:54 +0200
| Newsgroups | dev.linux.lists.kdevops |
|---|---|
| Message-ID | <20260423-kdevops-series-c-qemu-system-units-v1-2-b7bab3225a36@samsung.com> |
From: Daniel Gomez <[email protected]> The existing NIXOS backend pairs libvirt with a disk-image NixOS boot. The qsu-driven imageless path shares almost nothing with it at the lifecycle layer (no libvirtd, no libguestfs, no sudo, systemd user units instead of virsh, tmpfs-over-virtiofs instead of qcow2), so folding it behind a flag on NIXOS would collapse two user-facing choices whose surfaces are distinct. Introduce QEMU_SYSTEM_UNITS as its own choice entry with a matching KDEVOPS_ENABLE_QEMU_SYSTEM_UNITS bool, following the GUESTFS/NIXOS pattern. The QEMU_SYSTEM_UNITS entry also selects KDEVOPS_ENABLE_NIXOS because the guest is always a NixOS system (built from the nixos-qemu imageless template), which lets every NixOS-aware task across kdevops (devconfig, update_etc_hosts, gen_hosts, gen_nodes) pick the /run/current-system interpreter paths on qsu guests too. Hoist NIXOS_CONFIG_DIR out of the NIXOS block and into KDEVOPS_ENABLE_NIXOS so both backends share the same per-node configuration root. Note that qsu also supports image-based boot (cloud image, mkosi, qcow2, raw), but this series wires up only the imageless path. Generated-by: Claude AI Signed-off-by: Daniel Gomez <[email protected]> --- kconfigs/Kconfig.bringup | 18 ++++++++++++++++++ kconfigs/Kconfig.nixos | 18 +++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/kconfigs/Kconfig.bringup b/kconfigs/Kconfig.bringup index 39bd93b8..88c38d49 100644 --- a/kconfigs/Kconfig.bringup +++ b/kconfigs/Kconfig.bringup @@ -9,6 +9,10 @@ config KDEVOPS_ENABLE_NIXOS bool output yaml +config KDEVOPS_ENABLE_QEMU_SYSTEM_UNITS + bool + output yaml + config CLOUD_INITIALIZED bool default $(shell, test -f .cloud.initialized && echo y || echo n) = "y" @@ -69,6 +73,19 @@ config NIXOS NixOS will automatically infer the libvirt session type (system vs user) based on your distribution's defaults, similar to guestfs. +config QEMU_SYSTEM_UNITS + bool "qemu-system-units via systemd user units (imageless NixOS)" + select KDEVOPS_ENABLE_QEMU_SYSTEM_UNITS + select KDEVOPS_ENABLE_NIXOS + help + Drive VM lifecycle through systemd user units rendered from + scripts/qemu-system-units/, with nixos-qemu's imageless module as + the guest image (tmpfs root, virtiofs /nix/store, external + kernel). No libvirt daemon, no libguestfs, no sudo on the host. + The guest is NixOS so KDEVOPS_ENABLE_NIXOS is selected too, + letting existing Ansible roles pick the /run/current-system/sw/ + bash and python interpreter paths instead of /bin defaults. + config SKIP_BRINGUP bool "Skip bring up - bare metal or existing nodes" select EXTRA_STORAGE_SUPPORTS_512 @@ -95,3 +112,4 @@ source "kconfigs/Kconfig.declared_hosts" if LIBVIRT source "kconfigs/Kconfig.libvirt" endif +source "kconfigs/Kconfig.qemu_system_units" diff --git a/kconfigs/Kconfig.nixos b/kconfigs/Kconfig.nixos index 622b4492..ac4d4360 100644 --- a/kconfigs/Kconfig.nixos +++ b/kconfigs/Kconfig.nixos @@ -1,16 +1,24 @@ # SPDX-License-Identifier: copyleft-next-0.3.1 -if NIXOS +if KDEVOPS_ENABLE_NIXOS -config NIXOS_STORAGE_DIR +# Host-side path where per-node Nix configurations live (flake + +# default.nix rendered by the active backend). Shared between the +# libvirt-backed NIXOS choice and the imageless QEMU_SYSTEM_UNITS +# choice; both consume nixos-qemu modules from the same subtree. +config NIXOS_CONFIG_DIR string output yaml - default "{{ kdevops_storage_pool_path }}/nixos" + default "{{ topdir_path }}/scripts/nixos-qemu/configurations" -config NIXOS_CONFIG_DIR +endif # KDEVOPS_ENABLE_NIXOS + +if NIXOS + +config NIXOS_STORAGE_DIR string output yaml - default "{{ topdir_path }}/scripts/nixos-qemu/configurations" + default "{{ kdevops_storage_pool_path }}/nixos" config NIXOS_USE_FLAKES bool "Use Nix flakes for configuration" -- 2.53.0