* Move the setting of $MODULE_DIR to modprobe.nix.

* Add a slash to the end of $MODULE_DIR, as expected by depmod.  (Not
  that running depmod from the command line is all that useful, since
  you can't use it to update the tree in the Nix store.  But at least
  commands like "depmod -n" work now.)  Reported by Kirill Elagin on
  IRC.

svn path=/nixos/trunk/; revision=33312
This commit is contained in:
Eelco Dolstra 2012-03-20 22:02:27 +00:00
parent 6af26254ad
commit 6f03065dce
3 changed files with 7 additions and 4 deletions

@ -30,7 +30,6 @@ in
source = pkgs.substituteAll {
src = ./profile.sh;
wrapperDir = config.security.wrapperDir;
modulesTree = config.system.modulesTree;
shellInit = config.environment.shellInit;
};
target = "profile";

@ -14,7 +14,6 @@ export __ETC_PROFILE_DONE=1
# Initialise a bunch of environment variables.
export LOCALE_ARCHIVE=/var/run/current-system/sw/lib/locale/locale-archive
export LD_LIBRARY_PATH=/var/run/opengl-driver/lib:/var/run/opengl-driver-32/lib # !!! only set if needed
export MODULE_DIR=@modulesTree@/lib/modules
export NIXPKGS_CONFIG=/nix/etc/config.nix
export NIX_PATH=nixpkgs=/etc/nixos/nixpkgs:nixos=/etc/nixos/nixos:nixos-config=/etc/nixos/configuration.nix:services=/etc/nixos/services
export PAGER="less -R"

@ -18,13 +18,13 @@ with pkgs.lib;
text =
''
#! ${pkgs.stdenv.shell}
export MODULE_DIR=${config.system.modulesTree}/lib/modules
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
MODULE_DIR=/var/run/booted-system/kernel-modules/lib/modules/
fi
exec ${pkgs.module_init_tools}/sbin/modprobe "$@"
@ -102,6 +102,11 @@ with pkgs.lib;
echo ${config.system.sbin.modprobe}/sbin/modprobe > /proc/sys/kernel/modprobe
'';
environment.shellInit =
''
export MODULE_DIR=${config.system.modulesTree}/lib/modules/
'';
};
}