1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-11 07:04:28 +00:00
nixpkgs/pkgs/os-specific/linux/module-init-tools/aggregator.nix
Eelco Dolstra 089eef511c * Module aggregator: use buildEnv, which is much faster because it
creates symlinks lazily (i.e., it creates a single symlink to an
  entire tree unless another input has an overlapping tree).  As a
  result it creates only a few dozen symlinks instead of ~ 12000
  (which can take almost 2 minutes on my laptop).

svn path=/nixpkgs/branches/stdenv-updates/; revision=15200
2009-04-20 19:13:40 +00:00

28 lines
774 B
Nix

{stdenv, module_init_tools, modules, buildEnv}:
buildEnv {
name = "kernel-modules";
paths = modules;
postBuild =
''
source ${stdenv}/setup
kernelVersion=$(cd $out/lib/modules && ls -d *)
if test "$(echo $kernelVersion | wc -w)" != 1; then
echo "inconsistent kernel versions: $kernelVersion"
exit 1
fi
echo "kernel version is $kernelVersion"
# Regenerate the depmod map files. Be sure to pass an explicit
# kernel version number, otherwise depmod will use `uname -r'.
if test -w $out/lib/modules/$kernelVersion; then
rm -f $out/lib/modules/$kernelVersion/modules.*
MODULE_DIR=$out/lib/modules/ ${module_init_tools}/sbin/depmod -a $kernelVersion
fi
'';
}