2009-11-08 10:01:53 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-01-25 16:48:48 +01:00
|
|
|
|
2009-12-15 15:10:06 +01:00
|
|
|
let kernel = config.boot.kernelPackages.kernel; in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2009-01-25 16:48:48 +01:00
|
|
|
|
|
|
|
options = {
|
2009-12-15 15:10:06 +01:00
|
|
|
|
|
|
|
boot.kernelPackages = mkOption {
|
2010-03-16 13:10:06 +01:00
|
|
|
default = pkgs.linuxPackages;
|
2010-05-28 13:21:40 +02:00
|
|
|
# We don't want to evaluate all of linuxPackages for the manual
|
|
|
|
# - some of it might not even evaluate correctly.
|
|
|
|
defaultText = "pkgs.linuxPackages";
|
2010-03-16 13:10:06 +01:00
|
|
|
example = "pkgs.linuxPackages_2_6_25";
|
2009-12-15 15:10:06 +01:00
|
|
|
description = ''
|
|
|
|
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>nvidia_x11</varname>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.kernelParams = mkOption {
|
2010-01-05 14:11:12 +01:00
|
|
|
default = [ ];
|
2009-12-15 15:10:06 +01:00
|
|
|
description = ''
|
|
|
|
The kernel parameters. If you want to add additional
|
|
|
|
parameters, it's best to set
|
|
|
|
<option>boot.extraKernelParams</option>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.extraKernelParams = mkOption {
|
|
|
|
default = [ ];
|
|
|
|
example = [ "debugtrace" ];
|
|
|
|
description = "Additional user-defined kernel parameters.";
|
|
|
|
};
|
|
|
|
|
2010-01-15 22:55:51 +01:00
|
|
|
boot.vesa = mkOption {
|
|
|
|
default = true;
|
|
|
|
example = false;
|
|
|
|
description = ''
|
2011-09-02 15:19:45 +02:00
|
|
|
Whether to activate VESA video mode on boot.
|
2010-01-15 22:55:51 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-12-15 15:10:06 +01:00
|
|
|
boot.extraModulePackages = mkOption {
|
|
|
|
default = [];
|
|
|
|
# !!! example = [pkgs.aufs pkgs.nvidia_x11];
|
|
|
|
description = "A list of additional packages supplying kernel modules.";
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.kernelModules = mkOption {
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
The set of kernel modules to be loaded in the second stage of
|
|
|
|
the boot process. Note that modules that are needed to
|
|
|
|
mount the root file system should be added to
|
2009-12-15 17:38:20 +01:00
|
|
|
<option>boot.initrd.availableKernelModules</option> or
|
2009-12-15 15:10:06 +01:00
|
|
|
<option>boot.initrd.kernelModules</option>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-12-15 17:38:20 +01:00
|
|
|
boot.initrd.availableKernelModules = mkOption {
|
|
|
|
default = [];
|
|
|
|
example = [ "sata_nv" "ext3" ];
|
|
|
|
description = ''
|
|
|
|
The set of kernel modules in the initial ramdisk used during the
|
|
|
|
boot process. This set must include all modules necessary for
|
|
|
|
mounting the root device. That is, it should include modules
|
|
|
|
for the physical device (e.g., SCSI drivers) and for the file
|
|
|
|
system (e.g., ext3). The set specified here is automatically
|
|
|
|
closed under the module dependency relation, i.e., all
|
|
|
|
dependencies of the modules list here are included
|
|
|
|
automatically. The modules listed here are available in the
|
|
|
|
initrd, but are only loaded on demand (e.g., the ext3 module is
|
|
|
|
loaded automatically when an ext3 filesystem is mounted, and
|
|
|
|
modules for PCI devices are loaded when they match the PCI ID
|
|
|
|
of a device in your system). To force a module to be loaded,
|
|
|
|
include it in <option>boot.initrd.kernelModules</option>.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-12-15 15:10:06 +01:00
|
|
|
boot.initrd.kernelModules = mkOption {
|
2011-09-02 15:19:45 +02:00
|
|
|
default = [];
|
2009-12-15 17:38:20 +01:00
|
|
|
description = "List of modules that are always loaded by the initrd.";
|
|
|
|
};
|
|
|
|
|
|
|
|
system.modulesTree = mkOption {
|
|
|
|
internal = true;
|
|
|
|
default = [];
|
|
|
|
description = ''
|
|
|
|
Tree of kernel modules. This includes the kernel, plus modules
|
|
|
|
built outside of the kernel. Combine these into a single tree of
|
|
|
|
symlinks because modprobe only supports one directory.
|
|
|
|
'';
|
|
|
|
merge = mergeListOption;
|
|
|
|
# Convert the list of path to only one path.
|
|
|
|
apply = pkgs.aggregateModules;
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
|
|
system.build = { inherit kernel; };
|
|
|
|
|
|
|
|
system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
|
|
|
|
|
2010-01-05 14:11:12 +01:00
|
|
|
boot.kernelParams =
|
2011-09-02 15:19:45 +02:00
|
|
|
[ "splash=verbose"
|
|
|
|
# Force the Completely Fair Scheduler to be used by default.
|
|
|
|
"elevator=cfq"
|
|
|
|
] ++
|
2010-01-15 22:55:51 +01:00
|
|
|
optional config.boot.vesa "vga=0x317";
|
2010-01-05 14:11:12 +01:00
|
|
|
|
2009-12-15 17:38:20 +01:00
|
|
|
boot.kernelModules = [ "loop" ];
|
|
|
|
|
|
|
|
boot.initrd.availableKernelModules =
|
|
|
|
[ # Note: most of these (especially the SATA/PATA modules)
|
2009-12-15 15:10:06 +01:00
|
|
|
# shouldn't be included by default since nixos-hardware-scan
|
|
|
|
# detects them, but I'm keeping them for now for backwards
|
|
|
|
# compatibility.
|
|
|
|
|
|
|
|
# Some SATA/PATA stuff.
|
|
|
|
"ahci"
|
|
|
|
"sata_nv"
|
|
|
|
"sata_via"
|
|
|
|
"sata_sis"
|
|
|
|
"sata_uli"
|
|
|
|
"ata_piix"
|
|
|
|
"pata_marvell"
|
|
|
|
|
|
|
|
# Standard SCSI stuff.
|
|
|
|
"sd_mod"
|
|
|
|
"sr_mod"
|
|
|
|
|
|
|
|
# Standard IDE stuff.
|
|
|
|
"ide_cd"
|
|
|
|
"ide_disk"
|
|
|
|
"ide_generic"
|
|
|
|
|
|
|
|
# Filesystems.
|
2010-08-10 12:12:18 +02:00
|
|
|
"ext2" "ext3" "ext4"
|
2009-12-15 15:10:06 +01:00
|
|
|
|
|
|
|
# Support USB keyboards, in case the boot fails and we only have
|
|
|
|
# a USB keyboard.
|
|
|
|
"uhci_hcd"
|
|
|
|
"ehci_hcd"
|
|
|
|
"ohci_hcd"
|
|
|
|
"usbhid"
|
|
|
|
|
2009-12-15 17:38:20 +01:00
|
|
|
# Unix domain sockets (needed by udev).
|
2009-12-15 15:10:06 +01:00
|
|
|
"unix"
|
2011-09-02 15:19:45 +02:00
|
|
|
|
|
|
|
# Provide the CFQ scheduler in the initrd.
|
|
|
|
"cfq_iosched"
|
2009-12-15 17:38:20 +01:00
|
|
|
|
|
|
|
# Misc. stuff.
|
2009-12-17 00:45:10 +01:00
|
|
|
"pcips2" "serio" "atkbd" "xtkbd"
|
2009-12-15 15:10:06 +01:00
|
|
|
];
|
2009-12-15 17:38:20 +01:00
|
|
|
|
|
|
|
boot.initrd.kernelModules =
|
|
|
|
[ # For LVM.
|
|
|
|
"dm_mod"
|
2011-09-02 15:19:45 +02:00
|
|
|
|
|
|
|
# For usual AT keyboards.
|
|
|
|
"i8042"
|
2009-12-15 17:38:20 +01:00
|
|
|
];
|
2009-01-25 16:48:48 +01:00
|
|
|
|
2009-12-15 15:10:06 +01:00
|
|
|
# The Linux kernel >= 2.6.27 provides firmware.
|
|
|
|
hardware.firmware = [ "${kernel}/lib/firmware" ];
|
2009-12-15 14:09:06 +01:00
|
|
|
|
2009-12-15 15:10:06 +01:00
|
|
|
};
|
|
|
|
|
2009-01-25 16:48:48 +01:00
|
|
|
}
|