Add VM self-test configuration for NixOS

This commit is contained in:
2026-07-12 23:48:56 -03:00
parent d9b82bbf2b
commit 32cb8955eb
2 changed files with 45 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
# VM self-test overrides — used with nixos-rebuild build-vm to try the system
# in a VM without rebuilding/rebooting the host.
{ config, lib, pkgs, ... }:
{
virtualisation.vmVariant = {
config = {
hardware.nvidia-container-toolkit.enable = lib.mkForce false;
hardware.nvidia.package = lib.mkForce null;
services.xserver.videoDrivers = lib.mkForce [ "modesetting" ];
virtualisation = {
memorySize = 4096;
cores = 3;
graphics = true;
qemu.options = [
"-device virtio-vga-gl"
"-display gtk,gl=on"
];
};
users.users.olivier = {
initialPassword = lib.mkForce "";
hashedPasswordFile = lib.mkForce null; # Disable the secret file dependency
};
# Force greetd's `initial_session` directly. We can't rely on
# `services.displayManager.autoLogin` because DankGreeter's flake module
# (inputs.dms.nixosModules.greeter) aggressively overwrites
# `services.greetd.settings`, clobbering whatever the displayManager
# module injects for auto-login. mkForce on `initial_session` alone wins
# against DMS without touching `default_session` (DankGreeter), so a
# manual logout in the VM still shows DankGreeter. VM-only — host build
# is unaffected because this whole block lives under vmVariant.
services.greetd.settings.initial_session = lib.mkForce {
command = "${pkgs.niri}/bin/niri-session";
user = "olivier";
};
environment.systemPackages = [ pkgs.grc ];
};
};
}
+1
View File
@@ -15,6 +15,7 @@
self.nixosModules."client-services" self.nixosModules."client-services"
./_private/platform.nix ./_private/platform.nix
./_private/nvidia.nix ./_private/nvidia.nix
./_private/vm-self.nix
./_private/gpu-passthru.nix ./_private/gpu-passthru.nix
./_private/peripherals.nix ./_private/peripherals.nix
# ./_private/printing-epson.nix # ./_private/printing-epson.nix