* Reformat.

svn path=/nixos/trunk/; revision=18970
This commit is contained in:
Eelco Dolstra 2009-12-15 14:10:06 +00:00
parent a612fd0d5e
commit e8372257a1

View File

@ -2,164 +2,152 @@
with pkgs.lib; with pkgs.lib;
###### interface let kernel = config.boot.kernelPackages.kernel; in
let
{
###### interface
options = { 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
<varname>nvidia_x11</varname>.
";
};
kernelParams = mkOption { boot.kernelPackages = mkOption {
default = [ default = pkgs.kernelPackages;
"selinux=0" example = pkgs.kernelPackages_2_6_25;
"apm=on" description = ''
"acpi=on" This option allows you to override the Linux kernel used by
"console=tty1" NixOS. Since things like external kernel module packages are
"splash=verbose" tied to the kernel you're using, it also overrides those.
"vga=0x317" This option is a function that takes Nixpkgs as an argument
]; (as a convenience), and returns an attribute set containing at
description = " the very least an attribute <varname>kernel</varname>.
The kernel parameters. If you want to add additional Additional attributes may be needed depending on your
parameters, it's best to set configuration. For instance, if you use the NVIDIA X driver,
<option>boot.extraKernelParams</option>. then it also needs to contain an attribute
"; <varname>nvidia_x11</varname>.
}; '';
};
extraKernelParams = mkOption { boot.kernelParams = mkOption {
default = [ default = [
]; "selinux=0"
example = [ "apm=on"
"debugtrace" "acpi=on"
]; "console=tty1"
description = " "splash=verbose"
Additional user-defined kernel parameters. "vga=0x317"
"; ];
}; description = ''
The kernel parameters. If you want to add additional
parameters, it's best to set
<option>boot.extraKernelParams</option>.
'';
};
extraModulePackages = mkOption { boot.extraKernelParams = mkOption {
default = []; default = [ ];
# !!! example = [pkgs.aufs pkgs.nvidia_x11]; example = [ "debugtrace" ];
description = '' description = "Additional user-defined kernel parameters.";
A list of additional packages supplying kernel modules. };
'';
};
kernelModules = mkOption { boot.extraModulePackages = mkOption {
default = []; default = [];
description = '' # !!! example = [pkgs.aufs pkgs.nvidia_x11];
The set of kernel modules to be loaded in the second stage of description = "A list of additional packages supplying kernel modules.";
the boot process. Note that modules that are needed to };
mount the root file system should be added to
<option>boot.initrd.kernelModules</option>.
'';
};
initrd = { 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
<option>boot.initrd.kernelModules</option>.
'';
};
kernelModules = mkOption { boot.initrd.kernelModules = mkOption {
default = [ default = [
# Note: most of these (especially the SATA/PATA modules) # Note: most of these (especially the SATA/PATA modules)
# shouldn't be included by default since nixos-hardware-scan # shouldn't be included by default since nixos-hardware-scan
# detects them, but I'm keeping them for now for backwards # detects them, but I'm keeping them for now for backwards
# compatibility. # compatibility.
# Some SATA/PATA stuff. # Some SATA/PATA stuff.
"ahci" "ahci"
"sata_nv" "sata_nv"
"sata_via" "sata_via"
"sata_sis" "sata_sis"
"sata_uli" "sata_uli"
"ata_piix" "ata_piix"
"pata_marvell" "pata_marvell"
# Standard SCSI stuff. # Standard SCSI stuff.
"sd_mod" "sd_mod"
"sr_mod" "sr_mod"
# Standard IDE stuff. # Standard IDE stuff.
"ide_cd" "ide_cd"
"ide_disk" "ide_disk"
"ide_generic" "ide_generic"
# Filesystems. # Filesystems.
"ext2" "ext3" "ext2" "ext3"
# Support USB keyboards, in case the boot fails and we only have # Support USB keyboards, in case the boot fails and we only have
# a USB keyboard. # a USB keyboard.
"uhci_hcd" "uhci_hcd"
"ehci_hcd" "ehci_hcd"
"ohci_hcd" "ohci_hcd"
"usbhid" "usbhid"
# LVM. # LVM.
"dm_mod" "dm_mod"
# All-mod-config case: # All-mod-config case:
"unix" "unix"
"i8042" "pcips2" "serio" "atkbd" "xtkbd" "i8042" "pcips2" "serio" "atkbd" "xtkbd"
]; ];
description = " description = ''
The set of kernel modules in the initial ramdisk used during the The set of kernel modules in the initial ramdisk used during the
boot process. This set must include all modules necessary for boot process. This set must include all modules necessary for
mounting the root device. That is, it should include modules mounting the root device. That is, it should include modules
for the physical device (e.g., SCSI drivers) and for the file for the physical device (e.g., SCSI drivers) and for the file
system (e.g., ext3). The set specified here is automatically system (e.g., ext3). The set specified here is automatically
closed under the module dependency relation, i.e., all closed under the module dependency relation, i.e., all
dependencies of the modules list here are included dependencies of the modules list here are included
automatically. automatically.
"; '';
};
};
}; };
system.modulesTree = mkOption { system.modulesTree = mkOption {
internal = true; internal = true;
default = []; default = [];
description = " description = ''
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. Combine these into a single tree of built outside of the kernel. Combine these into a single tree of
symlinks because modprobe only supports one directory. symlinks because modprobe only supports one directory.
"; '';
merge = mergeListOption; merge = mergeListOption;
# Convert the list of path to only one path. # Convert the list of path to only one path.
apply = pkgs.aggregateModules; apply = pkgs.aggregateModules;
}; };
}; };
in
###### implementation ###### implementation
let
kernelPackages = config.boot.kernelPackages;
kernel = kernelPackages.kernel;
in
{ config = {
require = [ options ];
system.build = { inherit kernel; }; system.build = { inherit kernel; };
system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
boot.kernelModules = [ "loop" ]; system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages;
boot.kernelModules = [ "loop" ];
# The Linux kernel >= 2.6.27 provides firmware.
hardware.firmware = [ "${kernel}/lib/firmware" ];
};
# The Linux kernel >= 2.6.27 provides firmware.
hardware.firmware = [ "${kernel}/lib/firmware" ];
} }