diff --git a/configuration/rescue-cd.nix b/configuration/rescue-cd.nix
index 3c4b67e189c9..a69832d82691 100644
--- a/configuration/rescue-cd.nix
+++ b/configuration/rescue-cd.nix
@@ -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";
diff --git a/system/options.nix b/system/options.nix
index c60044e85aed..37d6023eef38 100644
--- a/system/options.nix
+++ b/system/options.nix
@@ -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 kernel.
+ 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
+ nvidiaDrivers.
";
};
diff --git a/system/system.nix b/system/system.nix
index e65aef0a427e..c55e31914afd 100644
--- a/system/system.nix
+++ b/system/system.nix
@@ -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;
};
diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix
index d1ea5b255087..9f2c0f1b14da 100644
--- a/upstart-jobs/default.nix
+++ b/upstart-jobs/default.nix
@@ -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 =