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

View File

@ -75,13 +75,20 @@
"; ";
}; };
kernel = mkOption { kernelPackages = mkOption {
default = pkgs: pkgs.kernel; default = pkgs: pkgs.kernelPackages;
example = pkgs: pkgs.kernelPackages_2_6_25;
description = " description = "
Function that takes package collection and returns kernel This option allows you to override the Linux kernel used by
package. Do not collect old generations after changing it NixOS. Since things like external kernel module packages are
until you get to boot successfully. In principle, you can tied to the kernel you're using, it also overrides those.
specify a kernel that will build, but not boot. 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; nix = config.environment.nix pkgs;
kernel = config.boot.kernel pkgs; kernelPackages = config.boot.kernelPackages pkgs;
kernel = kernelPackages.kernel;
rootModules = rootModules =
config.boot.initrd.extraKernelModules ++ config.boot.initrd.extraKernelModules ++
config.boot.initrd.kernelModules; config.boot.initrd.kernelModules;
# Tree of kernel modules. This includes the kernel, plus modules # Tree of kernel modules. This includes the kernel, plus modules
# built outside of the kernel. We have to combine these into a # built outside of the kernel. We have to combine these into a
# single tree of symlinks because modprobe only supports one # single tree of symlinks because modprobe only supports one
# directory. # directory.
modulesTree = pkgs.aggregateModules ( modulesTree = pkgs.aggregateModules (
[kernel] [kernel]
++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi ++ pkgs.lib.optional ((config.networking.enableIntel3945ABGFirmware || config.networking.enableIntel4965AGNFirmware) && !kernel.features ? iwlwifi) kernelPackages.iwlwifi
++ pkgs.lib.optional config.networking.enableIntel4965AGNFirmware pkgs.iwlwifi
# !!! this should be declared by the xserver Upstart job. # !!! 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.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") kernelPackages.nvidiaDrivers
++ pkgs.lib.optional config.hardware.enableGo7007 pkgs.wis_go7007 ++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007
++ config.boot.extraModulePackages ++ config.boot.extraModulePackages
); );
@ -116,21 +118,24 @@ rec {
{ object = bootStage1; { object = bootStage1;
symlink = "/init"; symlink = "/init";
} }
] ++ (if config.boot.initrd.enableSplashScreen then [ ] ++
{ object = pkgs.runCommand "splashutils" {} '' pkgs.lib.optionals
ensureDir $out/bin (config.boot.initrd.enableSplashScreen && kernelPackages.kernel.features ? fbSplash)
cp ${pkgs.splashutils}/bin/splash_helper $out/bin [
''; { object = pkgs.runCommand "splashutils" {} ''
suffix = "/bin/splash_helper"; ensureDir $out/bin
symlink = "/sbin/splash_helper"; cp ${kernelPackages.splashutils}/bin/splash_helper $out/bin
} '';
{ object = import ../helpers/unpack-theme.nix { suffix = "/bin/splash_helper";
inherit (pkgs) stdenv; symlink = "/sbin/splash_helper";
theme = config.services.ttyBackgrounds.defaultTheme; }
}; { object = import ../helpers/unpack-theme.nix {
symlink = "/etc/splash"; inherit (pkgs) stdenv;
} theme = config.services.ttyBackgrounds.defaultTheme;
] else []); };
symlink = "/etc/splash";
}
];
}; };
@ -171,7 +176,8 @@ rec {
# The services (Upstart) configuration for the system. # The services (Upstart) configuration for the system.
upstartJobs = import ../upstart-jobs/default.nix { 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 let
@ -391,9 +391,10 @@ let
) )
# Transparent TTY backgrounds. # Transparent TTY backgrounds.
++ optional config.services.ttyBackgrounds.enable ++ optional (config.services.ttyBackgrounds.enable && kernelPackages.kernel.features ? fbSplash)
(import ../upstart-jobs/tty-backgrounds.nix { (import ../upstart-jobs/tty-backgrounds.nix {
inherit (pkgs) stdenv splashutils; inherit (pkgs) stdenv;
inherit (kernelPackages) splashutils;
backgrounds = backgrounds =