2009-11-08 10:01:53 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
with pkgs.lib;
|
2009-01-25 16:48:48 +01:00
|
|
|
|
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
|
|
|
|
options = {
|
|
|
|
boot = {
|
|
|
|
kernelPackages = mkOption {
|
|
|
|
default = pkgs.kernelPackages;
|
|
|
|
example = pkgs.kernelPackages_2_6_25;
|
|
|
|
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
|
2009-04-08 16:01:16 +02:00
|
|
|
<varname>nvidia_x11</varname>.
|
2009-01-25 16:48:48 +01:00
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
kernelParams = mkOption {
|
|
|
|
default = [
|
2009-09-16 13:03:15 +02:00
|
|
|
"selinux=0"
|
2009-01-25 16:48:48 +01:00
|
|
|
"apm=on"
|
|
|
|
"acpi=on"
|
|
|
|
"console=tty1"
|
|
|
|
"splash=verbose"
|
2009-09-20 20:15:52 +02:00
|
|
|
"vga=0x317"
|
2009-01-25 16:48:48 +01:00
|
|
|
];
|
|
|
|
description = "
|
|
|
|
The kernel parameters. If you want to add additional
|
|
|
|
parameters, it's best to set
|
|
|
|
<option>boot.extraKernelParams</option>.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraKernelParams = mkOption {
|
|
|
|
default = [
|
|
|
|
];
|
|
|
|
example = [
|
|
|
|
"debugtrace"
|
|
|
|
];
|
|
|
|
description = "
|
|
|
|
Additional user-defined kernel parameters.
|
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
extraModulePackages = mkOption {
|
|
|
|
default = [];
|
2009-04-08 16:01:16 +02:00
|
|
|
# !!! example = [pkgs.aufs pkgs.nvidia_x11];
|
2009-01-25 16:48:48 +01:00
|
|
|
description = ''
|
|
|
|
A list of additional packages supplying kernel modules.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
kernelModules = mkOption {
|
|
|
|
default = [];
|
2009-12-15 15:05:01 +01:00
|
|
|
description = ''
|
2009-01-25 16:48:48 +01:00
|
|
|
The set of kernel modules to be loaded in the second stage of
|
2009-12-15 15:05:01 +01:00
|
|
|
the boot process. Note that modules that are needed to
|
|
|
|
mount the root file system should be added to
|
|
|
|
<option>boot.initrd.kernelModules</option>.
|
|
|
|
'';
|
2009-01-25 16:48:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
initrd = {
|
|
|
|
|
|
|
|
kernelModules = mkOption {
|
|
|
|
default = [
|
|
|
|
# Note: most of these (especially the SATA/PATA modules)
|
|
|
|
# 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.
|
2009-12-15 14:09:06 +01:00
|
|
|
"ext2" "ext3"
|
2009-01-25 16:48:48 +01:00
|
|
|
|
|
|
|
# Support USB keyboards, in case the boot fails and we only have
|
|
|
|
# a USB keyboard.
|
2009-09-20 20:15:52 +02:00
|
|
|
"uhci_hcd"
|
2009-01-25 16:48:48 +01:00
|
|
|
"ehci_hcd"
|
|
|
|
"ohci_hcd"
|
|
|
|
"usbhid"
|
|
|
|
|
|
|
|
# LVM.
|
|
|
|
"dm_mod"
|
2009-09-20 20:15:52 +02:00
|
|
|
|
|
|
|
# All-mod-config case:
|
|
|
|
"unix"
|
|
|
|
"i8042" "pcips2" "serio" "atkbd" "xtkbd"
|
2009-01-25 16:48:48 +01:00
|
|
|
];
|
|
|
|
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
|
2009-12-15 15:05:01 +01:00
|
|
|
automatically.
|
2009-01-25 16:48:48 +01:00
|
|
|
";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
2009-05-27 11:57:30 +02:00
|
|
|
|
|
|
|
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.
|
|
|
|
";
|
2009-11-08 10:01:53 +01:00
|
|
|
merge = mergeListOption;
|
2009-05-27 11:57:30 +02:00
|
|
|
|
|
|
|
# Convert the list of path to only one path.
|
|
|
|
apply = pkgs.aggregateModules;
|
|
|
|
};
|
|
|
|
|
2009-01-25 16:48:48 +01:00
|
|
|
};
|
2009-05-27 11:57:30 +02:00
|
|
|
|
2009-01-25 16:48:48 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
let
|
|
|
|
kernelPackages = config.boot.kernelPackages;
|
|
|
|
kernel = kernelPackages.kernel;
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
2009-09-20 20:15:52 +02:00
|
|
|
require = [ options ];
|
2009-01-25 16:48:59 +01:00
|
|
|
|
2009-09-14 00:13:19 +02:00
|
|
|
system.build = { inherit kernel; };
|
2009-08-10 21:27:15 +02:00
|
|
|
system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
|
2009-01-25 16:48:48 +01:00
|
|
|
|
2009-12-15 14:09:06 +01:00
|
|
|
boot.kernelModules = [ "loop" ];
|
|
|
|
|
2009-08-10 21:27:15 +02:00
|
|
|
# The Linux kernel >= 2.6.27 provides firmware.
|
|
|
|
hardware.firmware = [ "${kernel}/lib/firmware" ];
|
2009-01-25 16:48:48 +01:00
|
|
|
}
|