* Fall back to the kernel modules used at boot time if the modules in

the current configuration don't match the running kernel.  This
  ensures that modprobe still works after a "nixos-rebuild switch" to
  a configuration that has a different kernel version.

svn path=/nixos/trunk/; revision=19696
This commit is contained in:
Eelco Dolstra 2010-01-26 21:45:13 +00:00
parent 442093d27d
commit 0432766399
2 changed files with 9 additions and 0 deletions

View File

@ -69,6 +69,7 @@ let
false
fi
ln -s ${kernelPath} $out/kernel
ln -s ${config.system.modulesTree} $out/kernel-modules
if [ -n "$grub" ]; then
ln -s $grub $out/grub
fi

View File

@ -19,6 +19,14 @@ with pkgs.lib;
''
#! ${pkgs.stdenv.shell}
export MODULE_DIR=${config.system.modulesTree}/lib/modules
# Fall back to the kernel modules used at boot time if the
# modules in the current configuration don't match the
# running kernel.
if [ ! -d "$MODULE_DIR/$(${pkgs.coreutils}/bin/uname -r)" ]; then
MODULE_DIR=/var/run/booted-system/kernel-modules/lib/modules
fi
exec ${pkgs.module_init_tools}/sbin/modprobe "$@"
'';
};