From 1ae175fe995a54373b8adc2d8aaa592d34c9d3ae Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Wed, 26 Nov 2025 05:49:55 +0100 Subject: [PATCH] nixos/virtualbox-guest: Allow using in-tree kernel modules Since commit 78c1d0ba4ed1 ("linux: Enable Virtualbox guest modules") the NixOS kernel ships the in-tree kernel modules for Virtualbox guests. Since they do work well with the Virtualbox guest utils, add a switch to the related NixOS module allowing users to not use the 3rd party kernel modules. Enable the 3rd party modules by default in order to not change the current behavior. Signed-off-by: Felix Singer --- nixos/modules/virtualisation/virtualbox-guest.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/nixos/modules/virtualisation/virtualbox-guest.nix b/nixos/modules/virtualisation/virtualbox-guest.nix index 66b0aeb83c7a..86197d2e53f5 100644 --- a/nixos/modules/virtualisation/virtualbox-guest.nix +++ b/nixos/modules/virtualisation/virtualbox-guest.nix @@ -95,6 +95,12 @@ in type = lib.types.bool; description = "Whether to load vboxsf"; }; + + use3rdPartyModules = lib.mkOption { + default = true; + type = lib.types.bool; + description = "Whether to use the kernel modules provided by VirtualBox instead of the ones from the upstream kernel."; + }; }; ###### implementation @@ -111,7 +117,7 @@ in environment.systemPackages = [ kernel.virtualboxGuestAdditions ]; - boot.extraModulePackages = [ kernel.virtualboxGuestAdditions ]; + boot.extraModulePackages = lib.mkIf cfg.use3rdPartyModules [ kernel.virtualboxGuestAdditions ]; systemd.services.virtualbox = { description = "VirtualBox Guest Services";