3
0
Fork 0
forked from mirrors/nixpkgs

* Use the aggregator to combine the kernel modules tree with

externally-built modules so that (e.g.) "modprobe nvidia" Just
  Works.

svn path=/nixos/trunk/; revision=10129
This commit is contained in:
Eelco Dolstra 2008-01-12 23:37:17 +00:00
parent cfed953b5f
commit 26e0f711a9
5 changed files with 17 additions and 12 deletions

View file

@ -1,6 +1,5 @@
{ config, pkgs, upstartJobs, systemPath, wrapperDir
, defaultShell, extraEtc, nixEnvVars
, kernel ? null
, defaultShell, extraEtc, nixEnvVars, modulesTree
}:
let
@ -108,13 +107,11 @@ import ../helpers/make-etc.nix {
{ # Script executed when the shell starts.
source = pkgs.substituteAll {
src = ./profile.sh;
inherit systemPath wrapperDir;
inherit systemPath wrapperDir modulesTree;
inherit (pkgs) glibc;
timeZone = config.time.timeZone;
defaultLocale = config.i18n.defaultLocale;
inherit nixEnvVars;
systemKernel = (if kernel == null then
pkgs.systemKernel else kernel);
};
target = "profile";
}

View file

@ -1,5 +1,5 @@
export PATH=@wrapperDir@:/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
export MODULE_DIR=@systemKernel@/lib/modules
export MODULE_DIR=@modulesTree@/lib/modules
export NIXPKGS_CONFIG=/nix/etc/config.nix
export PAGER=less
export TZ=@timeZone@

View file

@ -1,3 +1,3 @@
#! @shell@
export MODULE_DIR=@kernel@/lib/modules
export MODULE_DIR=@modulesTree@/lib/modules
exec @module_init_tools@/sbin/modprobe "$@"

View file

@ -142,13 +142,24 @@ rec {
(map (mod: mod + "/lib") nssModules));
# Tree of kernel modules. This includes the kernel, plus modules
# built outside of the kernel. We have to combine these into a
# single tree of symlinks because modprobe only supports one
# directory.
modulesTree = pkgs.module_aggregation (
[kernel pkgs.iwlwifi]
# !!! this should be declared by the xserver Upstart job.
++ pkgs.lib.optional (config.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") pkgs.nvidiaDrivers
);
# Wrapper around modprobe to set the path to the modules.
modprobe = pkgs.substituteAll {
dir = "sbin";
src = ./modprobe;
isExecutable = true;
inherit (pkgs) module_init_tools;
inherit kernel;
inherit modulesTree;
};
@ -171,8 +182,7 @@ rec {
# The static parts of /etc.
etc = import ../etc/default.nix {
inherit config pkgs upstartJobs systemPath wrapperDir
defaultShell nixEnvVars;
inherit kernel;
defaultShell nixEnvVars modulesTree;
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
};

View file

@ -363,8 +363,6 @@ rec {
${if videoDriver == "nvidia"
then ''
ln -sf ${pkgs.nvidiaDrivers} /var/run/opengl-driver
# Ideally, the nvidia driver would be somewhere where modprobe looks for it...
${pkgs.module_init_tools}/sbin/insmod ${pkgs.nvidiaDrivers}/lib/nvidia.ko || true
''
else if cfg.driSupport
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"