How to run virtualbox on 25.05

Hello,

till the update from 24.11 to 25.05 virtualbox worked fine, but since, rebuilding generates an error.

sudo nixos-rebuild switch --upgrade
unpacking 2 channels...
building Nix...
building the system configuration...
these 18 derivations will be built:
  /nix/store/33xmh91vp8aybzp2cbiwj5h6f398wj8d-virtualbox-modules-7.1.8-6.15.drv
  /nix/store/89y9gbj9giap1c20ykkyx7qpgcjvxyyg-linux-6.15-modules.drv
  /nix/store/4mv7dp6989fcwf5d728zbj4xfq6q5prw-linux-6.15-modules-shrunk.drv
  /nix/store/jvnrjp6ciqgvyq7qigai6jj5nz9p4yfa-system-path.drv
  /nix/store/ihl564ssnpkdqqfdlvjqfaq1s93vplxc-dbus-1.drv
  /nix/store/zzmc4vyx1vv4c0i9zab81mimix7c80ly-X-Restart-Triggers-dbus.drv
  /nix/store/5x887x5kpzdds2478piwhlqhz53rxpfh-unit-dbus.service.drv
  /nix/store/6hbgjlfm1k7nqy10ka9kjq3a6c2zab54-closure-info.drv
  /nix/store/q8kzmazc2bwgprkzb32k73x54lcybwhk-unit-dbus.service.drv
  /nix/store/fxmd4cl2p73b8p0i9zfc432szg3jfjjc-user-units.drv
  /nix/store/zslrs6729war8kgvcc3nb0adbry3fynr-X-Restart-Triggers-polkit.drv
  /nix/store/c38yfzkbj0704ghvfbw8aqgn4vl75ns0-unit-polkit.service.drv
  /nix/store/sablh63g029i6c4b1ys7nd8lmncw20qk-unit-accounts-daemon.service.drv
  /nix/store/wcf30jssjzac9w1vr6mispp4dppyc2xb-system-units.drv
  /nix/store/fgvcp209zvcxd5ihyk0w3lnh93jhmq5v-etc.drv
  /nix/store/nm55cb7cb1bg1jpxc7jf1k8xndxy4aa2-initrd-linux-6.15.drv
  /nix/store/sdk3h5i5rmiy3b9kajdyak2wqpkcjq7d-boot.json.drv
  /nix/store/8bxqylpx4viw31m7jik2ikbpraaq45q3-nixos-system-SebastianLaptop-25.05.802985.a59eb7800787.drv
building '/nix/store/jvnrjp6ciqgvyq7qigai6jj5nz9p4yfa-system-path.drv'...
building '/nix/store/33xmh91vp8aybzp2cbiwj5h6f398wj8d-virtualbox-modules-7.1.8-6.15.drv'...
warning: collision between `/nix/store/hgzd57ksd5qikp5y2cy7l5kx3w2zzzq8-temurin-jre-bin-23.0.2/bin/java' and `/nix/store/njqi4hxzrqx6m406zdgqzvikf2q0bxld-openjdk-8u442-b06-jre/bin/java'
warning: collision between `/nix/store/hgzd57ksd5qikp5y2cy7l5kx3w2zzzq8-temurin-jre-bin-23.0.2/bin/keytool' and `/nix/store/njqi4hxzrqx6m406zdgqzvikf2q0bxld-openjdk-8u442-b06-jre/bin/keytool'
warning: collision between `/nix/store/hgzd57ksd5qikp5y2cy7l5kx3w2zzzq8-temurin-jre-bin-23.0.2/bin/rmiregistry' and `/nix/store/njqi4hxzrqx6m406zdgqzvikf2q0bxld-openjdk-8u442-b06-jre/bin/rmiregistry'
Running phase: unpackPhase
unpacking source archive /nix/store/dj72wlxrm79knpcbv6v13y4q910v4ygp-virtualbox-7.1.8-modsrc
source root is virtualbox-7.1.8-modsrc
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
build flags: -j14 SHELL=/nix/store/xy4jjgw87sbgwylm5kn047d9gkbhsr9x-bash-5.2p37/bin/bash INSTALL_MOD_PATH=\$\(out\)
=== Building 'vboxdrv' module ===
make[1]: Entering directory '/build/virtualbox-7.1.8-modsrc/vboxdrv'
make V= CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/build M=/build/virtualbox-7.1.8-modsrc/vboxdrv SRCROOT=/build/virtualbox-7.1.8-modsrc/vboxdrv -j14 modules
make[2]: Entering directory '/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/build'
make[2]: warning: -j14 forced in submake: resetting jobserver mode.
make[3]: Entering directory '/build/virtualbox-7.1.8-modsrc/vboxdrv'
  CC [M]  linux/SUPDrv-linux.o
  CC [M]  SUPDrv.o
  CC [M]  SUPDrvGip.o
  CC [M]  SUPDrvSem.o
  CC [M]  SUPDrvTracer.o
  CC [M]  SUPLibAll.o
  CC [M]  common/string/strformatrt.o
  CC [M]  combined-agnostic1.o
  CC [M]  combined-agnostic2.o
  CC [M]  combined-os-specific.o
In file included from linux/SUPDrv-linux.c:42:
linux/../SUPDrvInternal.h:47:10: fatal error: VBox/cdefs.h: No such file or directory
   47 | #include <VBox/cdefs.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
In file included from SUPDrv.c:43:
SUPDrvInternal.h:47:10: fatal error: VBox/cdefs.h: No such file or directory
   47 | #include <VBox/cdefs.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
In file included from SUPDrvGip.c:43:
SUPDrvInternal.h:47:10: fatal error: VBox/cdefs.h: No such file or directory
   47 | #include <VBox/cdefs.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: linux/SUPDrv-linux.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: SUPDrv.o] Error 1
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: SUPDrvGip.o] Error 1
In file included from SUPDrvTracer.c:43:
SUPDrvInternal.h:47:10: fatal error: VBox/cdefs.h: No such file or directory
   47 | #include <VBox/cdefs.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
In file included from SUPDrvSem.c:43:
SUPDrvInternal.h:47:10: fatal error: VBox/cdefs.h: No such file or directory
   47 | #include <VBox/cdefs.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
SUPLibAll.c:41:10: fatal error: VBox/sup.h: No such file or directory
   41 | #include <VBox/sup.h>
      |          ^~~~~~~~~~~~
compilation terminated.
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: SUPDrvTracer.o] Error 1
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: SUPDrvSem.o] Error 1
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: SUPLibAll.o] Error 1
common/string/strformatrt.c:42:10: fatal error: iprt/string.h: No such file or directory
   42 | #include <iprt/string.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
combined-agnostic1.c:38:10: fatal error: internal/iprt.h: No such file or directory
   38 | #include "internal/iprt.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: common/string/strformatrt.o] Error 1
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: combined-agnostic1.o] Error 1
combined-agnostic2.c:38:10: fatal error: internal/iprt.h: No such file or directory
   38 | #include "internal/iprt.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: combined-agnostic2.o] Error 1
combined-os-specific.c:38:10: fatal error: the-linux-kernel.h: No such file or directory
   38 | #include "the-linux-kernel.h"
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[5]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/scripts/Makefile.build:203: combined-os-specific.o] Error 1
make[4]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/Makefile:2003: .] Error 2
make[3]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/Makefile:248: __sub-make] Error 2
make[3]: Leaving directory '/build/virtualbox-7.1.8-modsrc/vboxdrv'
make[2]: *** [/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/source/Makefile:248: __sub-make] Error 2
make[2]: Leaving directory '/nix/store/gl4zb4minm4ddaz31lhsx2rr964z1gjl-linux-6.15-dev/lib/modules/6.15.0/build'
make[1]: *** [/build/virtualbox-7.1.8-modsrc/vboxdrv/Makefile-footer.gmk:145: vboxdrv] Error 2
make[1]: Leaving directory '/build/virtualbox-7.1.8-modsrc/vboxdrv'
make: *** [Makefile:78: vboxdrv] Error 2
error: builder for '/nix/store/33xmh91vp8aybzp2cbiwj5h6f398wj8d-virtualbox-modules-7.1.8-6.15.drv' failed with exit code 2
error: 1 dependencies of derivation '/nix/store/89y9gbj9giap1c20ykkyx7qpgcjvxyyg-linux-6.15-modules.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8bxqylpx4viw31m7jik2ikbpraaq45q3-nixos-system-SebastianLaptop-25.05.802985.a59eb7800787.drv' failed to build

the same error occurs on nixos-rebuild boot.

I have not changed anything in my configuration.nix which is here:

## Edit this configuration file to define what should be installed on
# your system.  Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

let
  nix-rice = builtins.fetchGit {
    url = "https://github.com/bertof/nix-rice.git";
    ref = "refs/tags/v0.3.0";  
  };
  nix-rice-overlay = import (nix-rice + "/overlay.nix");
  pkgs = import <nixpkgs> { overlays = [ nix-rice-overlay ];};
in

{ config,
  lib,
  pkgs,
  ...
 }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
#      ./sebastian.nix
    ];

  nix.settings.experimental-features = ["nix-command" "flakes"];


  # Bootloader.
  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  boot.initrd.luks.devices."luks-7f50a1da-6ec9-4ce1-b00e-faa1e3fc3ebd".device = "/dev/disk/by-uuid/7f50a1da-6ec9-4ce1-b00e-faa1e3fc3ebd";
  networking.hostName = "SebastianLaptop"; # Define your hostname.
  # networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

  # Configure network proxy if necessary
  # networking.proxy.default = "http://user:password@proxy:port/";
  # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";

  # Enable networking
  networking.networkmanager.enable = true;

  # Set your time zone.
  time.timeZone = "Europe/Berlin";

  # power management
  powerManagement.enable = true;
  services.thermald.enable = true;
  services.power-profiles-daemon.enable = false;
  services.tlp = {
      enable = true;
      settings = {
        CPU_SCALING_GOVERNOR_ON_AC = "powersave";
        CPU_SCALING_GOVERNOR_ON_BAT = "powersave";

        CPU_ENERGY_PERF_POLICY_ON_BAT = "powersave";
        CPU_ENERGY_PERF_POLICY_ON_AC = "powersave";

        CPU_MIN_PERF_ON_AC = 0;
        CPU_MAX_PERF_ON_AC = 80;
        CPU_MIN_PERF_ON_BAT = 0;
        CPU_MAX_PERF_ON_BAT = 80;

       #Optional helps save long term battery health
       START_CHARGE_THRESH_BAT0 = 40; # 40 and bellow it starts to charge
       STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging

      };
  };




  # Nix System configuration

  nix.settings.auto-optimise-store = true;

  # firmware Updates 
  services.fwupd.enable = lib.mkDefault true;

  # Select internationalisation properties.
  i18n.defaultLocale = "de_DE.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "de_DE.UTF-8";
    LC_IDENTIFICATION = "de_DE.UTF-8";
    LC_MEASUREMENT = "de_DE.UTF-8";
    LC_MONETARY = "de_DE.UTF-8";
    LC_NAME = "de_DE.UTF-8";
    LC_NUMERIC = "de_DE.UTF-8";
    LC_PAPER = "de_DE.UTF-8";
    LC_TELEPHONE = "de_DE.UTF-8";
    LC_TIME = "de_DE.UTF-8";
  };

  # Enable the X11 windowing system.
#  services.xserver.enable = true;

  # Enable the GNOME Desktop Environment.
  #services.xserver.displayManager.gdm.enable = true;
#  services.xserver.desktopManager.gnome.enable = true;
#  programs.hyprland.enable = true; # enable Hyprland

  services.displayManager.sddm.enable = true;
  services.displayManager.sddm.wayland.enable = true;
  services.desktopManager.plasma6.enable = true;
  programs.kdeconnect.enable = true;
  programs.ssh.startAgent = true;

programs.ssh.extraConfig = "
# Test if github.com works with ssh for cloning
Host codeberg.org
IdentityFile ~/.ssh/codeberg
";




#programs.ssh.askPassword = lib.mkForce "${pkgs.plasma5Packages.ksshaskpass}/bin/ksshaskpass";
#programs.sway = {
#       enable = true;
#       wrapperFeatures.gtk = true;
#       };

#services.displayManager.sessionPackages = with pkgs; [sway];

#programs.wayfire = {
#  enable = true;
#  plugins = with pkgs.wayfirePlugins; [
#    wcm
#    wf-shell
#    wayfire-plugins-extra
#  ];
#};
  services.gnome.gnome-keyring.enable = true;

  services.hardware.bolt.enable = true;
  
  # Configure keymap in X11
  services.xserver.xkb = {
    layout = "de";
    variant = "";
  };

  # Configure console keymap
  console.keyMap = "de";

  # Enable CUPS to print documents.
  services.printing.enable = true;
  services.avahi = {
    enable = true;
    nssmdns4 = true;
    openFirewall = true;
  };
  services.printing.drivers = with pkgs; [
        gutenprint
        gutenprintBin
        hplip
        postscript-lexmark
        samsung-unified-linux-driver
        splix
        brlaser
        brgenml1lpr
        canon-cups-ufr2
  ];
  
  services.flatpak.enable = true;

  # Enable sound with pipewire.
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
    # If you want to use JACK applications, uncomment this
    #jack.enable = true;

    # use the example session manager (no others are packaged yet so this is enabled by default,
    # no need to redefine it in your config for now)
    #media-session.enable = true;
  };

  # Enable touchpad support (enabled default in most desktopManager).
  # services.xserver.libinput.enable = true;

  # Define a user account. Don't forget to set a password with ‘passwd’.
  users.users.sebastian = {
    isNormalUser = true;
    description = "Sebastian";
    extraGroups = [ "networkmanager" "wheel" "dialout" ];
    packages = with pkgs; [
    #  thunderbird
    ];
  };

  # Install firefox.
  programs.firefox.enable = true;

  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;

  # List packages installed in system profile. To search, run:
  # $ nix search wget
  environment.systemPackages = with pkgs; [
  #  vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
  wget
  rnote
  git
  curl
  htop
  tmux
  chromium
  drawio
  fritzing
  gimp
  blender
  #arduino
  inkscape-with-extensions
  #inkscape-extensions.inkstitch
  kdePackages.kdenlive
  libreoffice-qt
  jre8
  usbutils
  nextcloud-client
  obs-studio
  pciutils
  openscad-unstable
#  openscad
  pdfarranger
  libsForQt5.kmag
  texstudio
  texliveFull
  vokoscreen-ng
  widelands
  xournalpp
  gns3-gui
  gns3-server
  kicad
  kikit
  kicadAddons.kikit
  kicadAddons.kikit-library
  fprintd
  imagemagick
  openboard
  traceroute
  exfatprogs
  beamerpresenter-poppler
  vscodium
#  xf86_input_wacom
#  libwacom
#  libwacom-surface
  wireguard-go
  wireguard-tools
  wireshark
  syncthing
  ciscoPacketTracer8
  signal-desktop
  gnome-extension-manager
  gnomeExtensions.tilingnome
  gnomeExtensions.custom-hot-corners-extended
  gnomeExtensions.color-picker
  gnomeExtensions.system-monitor-tray-indicator
  gnomeExtensions.user-themes
  cheese
  gnome-randr
  gparted
  whois
  neofetch
  python312Full
  python312Packages.dbus-python
  python312Packages.dbus-fast
  slop
  sct
  otpclient
  grim
  slurp
  wl-clipboard
  mako
  scdoc
  kitty
  element-desktop
  appimage-run
  endeavour
  #arduino-ide
  evince
  kdePackages.kompare
  joplin-desktop
  temurin-jre-bin-23
  prusa-slicer
  vlc
  kdePackages.merkuro
  nmap
  freecad-wayland
  kdePackages.kcalc
  kdePackages.kalgebra
  pdftk
  jetbrains.pycharm-community
  python312Packages.fastapi
  python312Packages.uvicorn
  dbeaver-bin
  font-manager
  kdePackages.kcontacts
  flameshot
  kdePackages.xdg-desktop-portal-kde
  xdg-desktop-portal
  ];


  programs.direnv.enable = true;


virtualisation.virtualbox.host.enableExtensionPack = true;
  virtualisation.virtualbox.host.enable = true;
  users.extraGroups.vboxusers.members = [ "sebastian" ];


networking.wireguard = {
  enable = false;  # Deaktiviere den automatischen Start
#  autoStart = false;
};


services.ollama = {
  enable = true;
  # Optional: preload models, see https://ollama.com/library
  loadModels = [ "llama3.2:3b" "wizardcoder" "codeqwen" ];
};



virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;

  # Some programs need SUID wrappers, can be configured further or are
  # started in user sessions.
  # programs.mtr.enable = true;
  # programs.gnupg.agent = {
  #   enable = true;
  #   enableSSHSupport = true;
  # };

  # List services that you want to enable:

  programs.dconf.enable = true;

  programs.evolution = {
    enable=true;
    plugins = [ pkgs.evolution-ews ];
  };
  # Enable the OpenSSH daemon.
  # services.openssh.enable = true;

  # Open ports in the firewall.
  # networking.firewall.allowedTCPPorts = [ ... ];
  # networking.firewall.allowedUDPPorts = [ ... ];
  # Or disable the firewall altogether.
  # networking.firewall.enable = false;

  networking.firewall = {
   # if packets are still dropped, they will show up in dmesg
   logReversePathDrops = true;
   # wireguard trips rpfilter up
   extraCommands = ''
     ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN
     ip46tables -t mangle -I nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN
   '';
   extraStopCommands = ''
     ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --sport 51820 -j RETURN || true
     ip46tables -t mangle -D nixos-fw-rpfilter -p udp -m udp --dport 51820 -j RETURN || true
   '';
  };


programs.steam = {
  enable = true;
  remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
  dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
  extraCompatPackages = with pkgs; [ proton-ge-bin ];
};



  # This value determines the NixOS release from which the default
  # settings for stateful data, like file locations and database versions
  # on your system were taken. It‘s perfectly fine and recommended to leave
  # this value at the release version of the first install of this system.
  # Before changing this value read the documentation for this option
  # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
  system.stateVersion = "24.05"; # Did you read the comment?

nix.gc = {
  automatic = true;
  dates = "weekly";
  options = "--delete-older-than 30d";
};

}

I hope, that somebody is able to help me.

Thanks Minnten

Ok, a short help is the change back to kernel 6.14 (25.05 has 6.15 as latest)
but I think that this could not be the solution.

Using a latest kernel package will regularly get you into trouble with any third party module you use, you always will have to wait for the 3rd party to update the modules.

Thanks, so always one version behind is ok for me.