* boot.kernel renamed to boot.kernelPackages (see the help for a

description) to allow all kernel-related packages to be overriden
  easily.  For instance, you can now say in configuration.nix

    boot = {
      kernelPackages = pkgs: pkgs.kernelPackages_2_6_25;
    };

  to use Linux 2.6.25.x.  Externel kernel module packages (like
  the NVIDIA drivers) appropriate for this kernel will then be used
  automatically.

svn path=/nixos/trunk/; revision=11880
This commit is contained in:
Eelco Dolstra 2008-05-22 11:59:46 +00:00
parent 27fced519e
commit bb1ee3f190
4 changed files with 48 additions and 32 deletions

View file

@ -19,7 +19,9 @@ rec {
# The label used to identify the installation CD.
rootLabel = "NIXOS";
extraTTYs = [7 8]; # manual, rogue
extraModulePackages = [pkgs.aufs];
extraModulePackages = [system.kernelPackages.aufs];
#kernelPackages = pkgs: pkgs.kernelPackages_2_6_25;
initrd = {
extraKernelModules = [
@ -263,7 +265,7 @@ rec {
{ source = grubCfg;
target = "boot/grub/menu.lst";
}
{ source = pkgs.kernel + "/vmlinuz";
{ source = system.kernel + "/vmlinuz";
target = "boot/vmlinuz";
}
{ source = system.initialRamdisk + "/initrd";

View file

@ -75,13 +75,20 @@
";
};
kernel = mkOption {
default = pkgs: pkgs.kernel;
kernelPackages = mkOption {
default = pkgs: pkgs.kernelPackages;
example = pkgs: pkgs.kernelPackages_2_6_25;
description = "
Function that takes package collection and returns kernel
package. Do not collect old generations after changing it
until you get to boot successfully. In principle, you can
specify a kernel that will build, but not boot.
This option allows you to override the Linux kernel used by
NixOS. Since things like external kernel module packages are
tied to the kernel you're using, it also overrides those.
This option is a function that takes Nixpkgs as an argument
(as a convenience), and returns an attribute set containing at
the very least an attribute <varname>kernel</varname>.
Additional attributes may be needed depending on your
configuration. For instance, if you use the NVIDIA X driver,
then it also needs to contain an attribute
<varname>nvidiaDrivers</varname>.
";
};

View file

@ -33,24 +33,26 @@ rec {
nix = config.environment.nix pkgs;
kernel = config.boot.kernel pkgs;
kernelPackages = config.boot.kernelPackages pkgs;
kernel = kernelPackages.kernel;
rootModules =
config.boot.initrd.extraKernelModules ++
config.boot.initrd.kernelModules;
# 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.aggregateModules (
[kernel]
++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi
++ pkgs.lib.optional config.networking.enableIntel4965AGNFirmware pkgs.iwlwifi
++ pkgs.lib.optional ((config.networking.enableIntel3945ABGFirmware || config.networking.enableIntel4965AGNFirmware) && !kernel.features ? iwlwifi) kernelPackages.iwlwifi
# !!! this should be declared by the xserver Upstart job.
++ pkgs.lib.optional (config.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") pkgs.nvidiaDrivers
++ pkgs.lib.optional config.hardware.enableGo7007 pkgs.wis_go7007
++ pkgs.lib.optional (config.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") kernelPackages.nvidiaDrivers
++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
++ config.boot.extraModulePackages
);
@ -116,21 +118,24 @@ rec {
{ object = bootStage1;
symlink = "/init";
}
] ++ (if config.boot.initrd.enableSplashScreen then [
{ object = pkgs.runCommand "splashutils" {} ''
ensureDir $out/bin
cp ${pkgs.splashutils}/bin/splash_helper $out/bin
'';
suffix = "/bin/splash_helper";
symlink = "/sbin/splash_helper";
}
{ object = import ../helpers/unpack-theme.nix {
inherit (pkgs) stdenv;
theme = config.services.ttyBackgrounds.defaultTheme;
};
symlink = "/etc/splash";
}
] else []);
] ++
pkgs.lib.optionals
(config.boot.initrd.enableSplashScreen && kernelPackages.kernel.features ? fbSplash)
[
{ object = pkgs.runCommand "splashutils" {} ''
ensureDir $out/bin
cp ${kernelPackages.splashutils}/bin/splash_helper $out/bin
'';
suffix = "/bin/splash_helper";
symlink = "/sbin/splash_helper";
}
{ object = import ../helpers/unpack-theme.nix {
inherit (pkgs) stdenv;
theme = config.services.ttyBackgrounds.defaultTheme;
};
symlink = "/etc/splash";
}
];
};
@ -171,7 +176,8 @@ rec {
# The services (Upstart) configuration for the system.
upstartJobs = import ../upstart-jobs/default.nix {
inherit config pkgs nix modprobe nssModulesPath nixEnvVars optionDeclarations;
inherit config pkgs nix modprobe nssModulesPath nixEnvVars
optionDeclarations kernelPackages;
};

View file

@ -1,4 +1,4 @@
{config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars, optionDeclarations}:
{config, pkgs, nix, modprobe, nssModulesPath, nixEnvVars, optionDeclarations, kernelPackages}:
let
@ -391,9 +391,10 @@ let
)
# Transparent TTY backgrounds.
++ optional config.services.ttyBackgrounds.enable
++ optional (config.services.ttyBackgrounds.enable && kernelPackages.kernel.features ? fbSplash)
(import ../upstart-jobs/tty-backgrounds.nix {
inherit (pkgs) stdenv splashutils;
inherit (pkgs) stdenv;
inherit (kernelPackages) splashutils;
backgrounds =