summary refs log tree commit diff
path: root/pkgs/os-specific/linux/virtualbox
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 /pkgs/os-specific/linux/virtualbox
parent6d69293f26ff57a2621b299409af814ba7226413 (diff)
downloadnixpkgs-8bd89c922d527a60d5511a1d8c9d080321478da6.tar
nixpkgs-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.gz
nixpkgs-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.bz2
nixpkgs-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.lz
nixpkgs-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.xz
nixpkgs-8bd89c922d527a60d5511a1d8c9d080321478da6.tar.zst
nixpkgs-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 'pkgs/os-specific/linux/virtualbox')
-rw-r--r--pkgs/os-specific/linux/virtualbox/default.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/virtualbox/default.nix b/pkgs/os-specific/linux/virtualbox/default.nix
new file mode 100644
index 00000000000..593c4400b7f
--- /dev/null
+++ b/pkgs/os-specific/linux/virtualbox/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, virtualbox, kernel, strace }:
+
+stdenv.mkDerivation {
+  name = "virtualbox-modules-${virtualbox.version}-${kernel.version}";
+  src = virtualbox.modsrc;
+  hardeningDisable = [
+    "fortify" "pic" "stackprotector"
+  ];
+
+  makeFlags = [
+    "-C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
+    "INSTALL_MOD_PATH=$(out)"
+  ];
+  preBuild = "makeFlagsArray+=(\"M=$(pwd)\")";
+  buildFlags = [ "modules" ];
+  installTargets = [ "modules_install" ];
+
+  enableParallelBuilding = true;
+
+  meta = virtualbox.meta // {
+    description = virtualbox.meta.description + " (kernel modules)";
+  };
+}