1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

* More refactoring; move some of the boot time options into the

options framework.

svn path=/nixos/trunk/; revision=7317
This commit is contained in:
Eelco Dolstra 2006-12-11 16:10:23 +00:00
parent 7573a88ca6
commit 74783a4510
5 changed files with 90 additions and 29 deletions

View file

@ -21,14 +21,13 @@
stage2Init ? "/init"
}:
assert !autoDetectRootDevice -> rootDevice != "";
assert autoDetectRootDevice -> rootLabel != "";
substituteAll {
src = ./boot-stage-1-init.sh;
isExecutable = true;
inherit staticShell modules;
inherit autoDetectRootDevice rootDevice rootLabel;
inherit autoDetectRootDevice;
rootDevice = if !autoDetectRootDevice then rootDevice else "";
rootLabel = if autoDetectRootDevice then rootLabel else "";
path = [
staticTools
module_init_tools

View file

@ -1,17 +1,13 @@
{ system ? __currentSystem
, autoDetectRootDevice ? false
, rootDevice ? ""
, rootLabel ? ""
, stage2Init
, readOnlyRoot
, configData ? {}
, configuration
}:
rec {
# Make a configuration object from which we can retrieve option
# values.
config = import ./config.nix pkgs.library configData;
config = import ./config.nix pkgs.library configuration;
pkgs = import ../pkgs/top-level/all-packages.nix {inherit system;};
@ -71,7 +67,9 @@ rec {
inherit (pkgs) substituteAll;
inherit (pkgsDiet) module_init_tools;
inherit extraUtils;
inherit autoDetectRootDevice rootDevice rootLabel;
autoDetectRootDevice = config.get ["boot" "autoDetectRootDevice"];
rootDevice = config.get ["boot" "rootDevice"];
rootLabel = config.get ["boot" "rootLabel"];
inherit stage2Init;
modules = modulesClosure;
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
@ -172,8 +170,8 @@ rec {
isExecutable = true;
inherit etc;
inherit readOnlyRoot;
inherit (pkgs) kernel;
readOnlyRoot = config.get ["boot" "readOnlyRoot"];
hostName = config.get ["networking" "hostname"];
wrapperDir = setuidWrapper.wrapperDir;
accounts = ../helpers/accounts.sh;
@ -198,8 +196,8 @@ rec {
bootStage2 = import ../boot/boot-stage-2.nix {
inherit (pkgs) substituteAll coreutils
utillinux kernel udev upstart;
inherit readOnlyRoot;
inherit activateConfiguration;
readOnlyRoot = config.get ["boot" "readOnlyRoot"];
upstartPath = [
pkgs.coreutils
pkgs.findutils

View file

@ -1,11 +1,67 @@
[
[
{
{
name = ["networking" "hostname"];
default = "nixos";
description = "The name of the machine.";
}
{
name = ["boot" "autoDetectRootDevice"];
default = false;
description = "
Whether to find the root device automatically by searching for a
device with the right label. If this option is off, then
<option>boot.rootDevice</option> must be set.
";
}
{
name = ["boot" "rootDevice"];
example = "/dev/hda1";
description = "
The device to be mounted on / at system startup.
";
}
{
name = ["boot" "readOnlyRoot"];
default = false;
description = "
Whether the root device should be mounted writable. This should
be set when booting from CD-ROM.
";
}
{
name = ["boot" "rootLabel"];
description = "
When auto-detecting the root device (see
<option>boot.autoDetectRootDevice</option>), this option
specifies the label of the root device. Right now, this is
merely a file name that should exist in the root directory of
the file system. It is used to find the boot CD-ROM.
";
}
{
name = ["boot" "grubDevice"];
default = "";
example = "/dev/hda";
description = "
The device on which the boot loader, Grub, will be installed.
If empty, Grub won't be installed and it's your responsibility
to make the system bootable.
";
}
{
name = ["networking" "useDHCP"];
default = true;
@ -16,6 +72,7 @@
";
}
{
name = ["networking" "interfaces"];
default = [];
@ -33,6 +90,7 @@
";
}
{
name = ["filesystems" "mountPoints"];
example = [
@ -48,6 +106,7 @@
";
}
{
name = ["services" "syslogd" "tty"];
default = 10;
@ -56,7 +115,8 @@
messages.
";
}
{
name = ["services" "mingetty" "ttys"];
default = [1 2 3 4 5 6];
@ -65,7 +125,8 @@
login prompt.
";
}
{
name = ["services" "mingetty" "waitOnMounts"];
default = false;
@ -77,6 +138,7 @@
";
}
{
name = ["services" "sshd" "enable"];
default = false;
@ -86,6 +148,7 @@
";
}
{
name = ["services" "sshd" "forwardX11"];
default = false;
@ -94,4 +157,5 @@
";
}
]

View file

@ -1,18 +1,18 @@
let
# The root device.
rootDevice = "/dev/hda1";
# The device on which GRUB should be installed (leave empty if you
# don't want GRUB to be installed).
grubDevice = "/dev/hda";
configuration = {
boot = {
autoDetectRootDevice = false;
rootDevice = "/dev/hda1";
readOnlyRoot = false;
grubDevice = "/dev/hda";
};
};
# Build boot scripts.
bootEnv = import ./boot-environment.nix {
autoDetectRootDevice = false;
inherit rootDevice;
stage2Init = ""; # Passed on the command line via Grub.
readOnlyRoot = false;
inherit configuration;
};
# Extra kernel command line arguments.
@ -34,12 +34,12 @@ rec {
inherit upstartJobs;
systemConfiguration = pkgs.stdenvNew.mkDerivation {
system = pkgs.stdenvNew.mkDerivation {
name = "system-configuration";
builder = ./system-configuration.sh;
switchToConfiguration = ./switch-to-configuration.sh;
inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils;
inherit grubDevice;
grubDevice = "/dev/hda"; # !!!
inherit bootStage2;
inherit activateConfiguration;
inherit grubMenuBuilder;

View file

@ -1,4 +1,4 @@
#! /bin/sh
set -e
nix-build configuration/system-configuration.nix -A systemConfiguration -K -k
nix-build configuration/system-configuration.nix -A system -K -k
./result/bin/switch-to-configuration test