`nixos-rebuild build-vm` & specialisations?

I’ve noticed that nixos-rebuild build-vm always builds the “base” configuration, even when explicitly specifying a specialisation using --specialisation. Maybe it’s just not implemented?

What’s even more strange to me is that the “content” of the build VM also contain (as in packages are in my PATH) all the configuration of the specialisations even though when I boot the “base” configuration on real hardware that is not the case.

For a bit of context:
I’m utilizing specialisations to ensure that I can boot into different desktop environments / window managers without mixing stuff (systemd units, PATH, …). For example: when in KDE Plasma I don’t need to start the waybar systemd unit, the easiest way to achieve this is to separate these things in dedicated specialisations.

Every time I boot my PC I need to decide between the base configuration, the “plasma” or the “niri” specialisation. When booting the “base” configuration, I end up in a bare TTY with no display manager, just like I expect, because the “base” configuration declares no such thing.

In the VM that the build-vm script starts, I always have access to everything, so both plasma and niri selectable in GDM.

Even when explicitly “manually” building the system.build.vm derivation of the specialisation (nix build .#nixosConfigurations.framework.config.specialisation.niri.system.build.vm) and running it, it contains KDE Plasma binaries in PATH. While the identical specialisation on the hardware itself doesn’t contain KDE Plasma.

Ideally I want nixos-rebuild build-vm to behave identically (or as near as possible) to how the configuration would look on hardware, and that for me includes proper working specialisations.

Is that somehow already possible? If not, I would greatly appreciate some pointers and ideas on how to get started.

1 Like

Ok wow, never mind I found the issue :exploding_head: In some file, because I’ve played around with other stuff, I actually enabled both the plasma and niri in the base configuration :expressionless_face:

So I guess now only the feature request would be left: to have nixos-rebuild build-vm support the specialisation flag :slight_smile:

1 Like