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:
parent
cfed953b5f
commit
26e0f711a9
5 changed files with 17 additions and 12 deletions
|
@ -1,6 +1,5 @@
|
||||||
{ config, pkgs, upstartJobs, systemPath, wrapperDir
|
{ config, pkgs, upstartJobs, systemPath, wrapperDir
|
||||||
, defaultShell, extraEtc, nixEnvVars
|
, defaultShell, extraEtc, nixEnvVars, modulesTree
|
||||||
, kernel ? null
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -108,13 +107,11 @@ import ../helpers/make-etc.nix {
|
||||||
{ # Script executed when the shell starts.
|
{ # Script executed when the shell starts.
|
||||||
source = pkgs.substituteAll {
|
source = pkgs.substituteAll {
|
||||||
src = ./profile.sh;
|
src = ./profile.sh;
|
||||||
inherit systemPath wrapperDir;
|
inherit systemPath wrapperDir modulesTree;
|
||||||
inherit (pkgs) glibc;
|
inherit (pkgs) glibc;
|
||||||
timeZone = config.time.timeZone;
|
timeZone = config.time.timeZone;
|
||||||
defaultLocale = config.i18n.defaultLocale;
|
defaultLocale = config.i18n.defaultLocale;
|
||||||
inherit nixEnvVars;
|
inherit nixEnvVars;
|
||||||
systemKernel = (if kernel == null then
|
|
||||||
pkgs.systemKernel else kernel);
|
|
||||||
};
|
};
|
||||||
target = "profile";
|
target = "profile";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
export PATH=@wrapperDir@:/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
|
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 NIXPKGS_CONFIG=/nix/etc/config.nix
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
export TZ=@timeZone@
|
export TZ=@timeZone@
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#! @shell@
|
#! @shell@
|
||||||
export MODULE_DIR=@kernel@/lib/modules
|
export MODULE_DIR=@modulesTree@/lib/modules
|
||||||
exec @module_init_tools@/sbin/modprobe "$@"
|
exec @module_init_tools@/sbin/modprobe "$@"
|
||||||
|
|
|
@ -142,13 +142,24 @@ rec {
|
||||||
(map (mod: mod + "/lib") nssModules));
|
(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.
|
# Wrapper around modprobe to set the path to the modules.
|
||||||
modprobe = pkgs.substituteAll {
|
modprobe = pkgs.substituteAll {
|
||||||
dir = "sbin";
|
dir = "sbin";
|
||||||
src = ./modprobe;
|
src = ./modprobe;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
inherit (pkgs) module_init_tools;
|
inherit (pkgs) module_init_tools;
|
||||||
inherit kernel;
|
inherit modulesTree;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,8 +182,7 @@ rec {
|
||||||
# The static parts of /etc.
|
# The static parts of /etc.
|
||||||
etc = import ../etc/default.nix {
|
etc = import ../etc/default.nix {
|
||||||
inherit config pkgs upstartJobs systemPath wrapperDir
|
inherit config pkgs upstartJobs systemPath wrapperDir
|
||||||
defaultShell nixEnvVars;
|
defaultShell nixEnvVars modulesTree;
|
||||||
inherit kernel;
|
|
||||||
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
|
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -363,8 +363,6 @@ rec {
|
||||||
${if videoDriver == "nvidia"
|
${if videoDriver == "nvidia"
|
||||||
then ''
|
then ''
|
||||||
ln -sf ${pkgs.nvidiaDrivers} /var/run/opengl-driver
|
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
|
else if cfg.driSupport
|
||||||
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
|
then "ln -sf ${pkgs.mesa} /var/run/opengl-driver"
|
||||||
|
|
Loading…
Add table
Reference in a new issue