summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-09-13 03:42:16 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-09-13 06:12:38 +0200
commit8bd89c922d527a60d5511a1d8c9d080321478da6 (patch)
treebe272cf7816baa73a6f88132287a62f6aac5372c /nixos/modules
parent6d69293f26ff57a2621b299409af814ba7226413 (diff)
downloadnixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.tar
nixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.gz
nixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.bz2
nixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.lz
nixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.xz
nixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.zst
nixlib-8bd89c922d527a60d5511a1d8c9d080321478da6.zip
virtualbox: Split kernel modules into own package
Putting the kernel modules into the same output path as the main
VirtualBox derivation causes all of VirtualBox to be rebuilt on every
single kernel update.

The build process of VirtualBox already outputs the kernel module source
along with the generated files for the configuration of the main
VirtualBox package. We put this into a different output called "modsrc"
which we re-use from linuxPackages.virtualbox, which is now only
containing the resulting kernel modules without the main user space
implementation.

This not only has the advantage of decluttering the Nix expression for
the user space portions but also gets rid of the need to nuke references
and the need to patch out "depmod -a".

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/virtualisation/virtualbox-host.nix9
1 files changed, 7 insertions, 2 deletions
diff --git a/nixos/modules/virtualisation/virtualbox-host.nix b/nixos/modules/virtualisation/virtualbox-host.nix
index ce4abecd6762..7214543871d6 100644
--- a/nixos/modules/virtualisation/virtualbox-host.nix
+++ b/nixos/modules/virtualisation/virtualbox-host.nix
@@ -4,10 +4,15 @@ with lib;
 
 let
   cfg = config.virtualisation.virtualbox.host;
-  virtualbox = config.boot.kernelPackages.virtualbox.override {
+
+  virtualbox = pkgs.virtualbox.override {
     inherit (cfg) enableHardening headless;
   };
 
+  kernelModules = config.boot.kernelPackages.virtualbox.override {
+    inherit virtualbox;
+  };
+
 in
 
 {
@@ -60,7 +65,7 @@ in
 
   config = mkIf cfg.enable (mkMerge [{
     boot.kernelModules = [ "vboxdrv" "vboxnetadp" "vboxnetflt" ];
-    boot.extraModulePackages = [ virtualbox ];
+    boot.extraModulePackages = [ kernelModules ];
     environment.systemPackages = [ virtualbox ];
 
     security.setuidOwners = let