# 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 ];
    };
  };
}
