* More refactoring; move some of the boot time options into the
options framework. svn path=/nixos/trunk/; revision=7317
This commit is contained in:
parent
7573a88ca6
commit
74783a4510
@ -21,14 +21,13 @@
|
|||||||
stage2Init ? "/init"
|
stage2Init ? "/init"
|
||||||
}:
|
}:
|
||||||
|
|
||||||
assert !autoDetectRootDevice -> rootDevice != "";
|
|
||||||
assert autoDetectRootDevice -> rootLabel != "";
|
|
||||||
|
|
||||||
substituteAll {
|
substituteAll {
|
||||||
src = ./boot-stage-1-init.sh;
|
src = ./boot-stage-1-init.sh;
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
inherit staticShell modules;
|
inherit staticShell modules;
|
||||||
inherit autoDetectRootDevice rootDevice rootLabel;
|
inherit autoDetectRootDevice;
|
||||||
|
rootDevice = if !autoDetectRootDevice then rootDevice else "";
|
||||||
|
rootLabel = if autoDetectRootDevice then rootLabel else "";
|
||||||
path = [
|
path = [
|
||||||
staticTools
|
staticTools
|
||||||
module_init_tools
|
module_init_tools
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
{ system ? __currentSystem
|
{ system ? __currentSystem
|
||||||
, autoDetectRootDevice ? false
|
|
||||||
, rootDevice ? ""
|
|
||||||
, rootLabel ? ""
|
|
||||||
, stage2Init
|
, stage2Init
|
||||||
, readOnlyRoot
|
, configuration
|
||||||
, configData ? {}
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
# Make a configuration object from which we can retrieve option
|
# Make a configuration object from which we can retrieve option
|
||||||
# values.
|
# 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;};
|
pkgs = import ../pkgs/top-level/all-packages.nix {inherit system;};
|
||||||
@ -71,7 +67,9 @@ rec {
|
|||||||
inherit (pkgs) substituteAll;
|
inherit (pkgs) substituteAll;
|
||||||
inherit (pkgsDiet) module_init_tools;
|
inherit (pkgsDiet) module_init_tools;
|
||||||
inherit extraUtils;
|
inherit extraUtils;
|
||||||
inherit autoDetectRootDevice rootDevice rootLabel;
|
autoDetectRootDevice = config.get ["boot" "autoDetectRootDevice"];
|
||||||
|
rootDevice = config.get ["boot" "rootDevice"];
|
||||||
|
rootLabel = config.get ["boot" "rootLabel"];
|
||||||
inherit stage2Init;
|
inherit stage2Init;
|
||||||
modules = modulesClosure;
|
modules = modulesClosure;
|
||||||
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
|
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
|
||||||
@ -172,8 +170,8 @@ rec {
|
|||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
|
|
||||||
inherit etc;
|
inherit etc;
|
||||||
inherit readOnlyRoot;
|
|
||||||
inherit (pkgs) kernel;
|
inherit (pkgs) kernel;
|
||||||
|
readOnlyRoot = config.get ["boot" "readOnlyRoot"];
|
||||||
hostName = config.get ["networking" "hostname"];
|
hostName = config.get ["networking" "hostname"];
|
||||||
wrapperDir = setuidWrapper.wrapperDir;
|
wrapperDir = setuidWrapper.wrapperDir;
|
||||||
accounts = ../helpers/accounts.sh;
|
accounts = ../helpers/accounts.sh;
|
||||||
@ -198,8 +196,8 @@ rec {
|
|||||||
bootStage2 = import ../boot/boot-stage-2.nix {
|
bootStage2 = import ../boot/boot-stage-2.nix {
|
||||||
inherit (pkgs) substituteAll coreutils
|
inherit (pkgs) substituteAll coreutils
|
||||||
utillinux kernel udev upstart;
|
utillinux kernel udev upstart;
|
||||||
inherit readOnlyRoot;
|
|
||||||
inherit activateConfiguration;
|
inherit activateConfiguration;
|
||||||
|
readOnlyRoot = config.get ["boot" "readOnlyRoot"];
|
||||||
upstartPath = [
|
upstartPath = [
|
||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
pkgs.findutils
|
pkgs.findutils
|
||||||
|
@ -1,11 +1,67 @@
|
|||||||
[
|
[
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["networking" "hostname"];
|
name = ["networking" "hostname"];
|
||||||
default = "nixos";
|
default = "nixos";
|
||||||
description = "The name of the machine.";
|
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"];
|
name = ["networking" "useDHCP"];
|
||||||
default = true;
|
default = true;
|
||||||
@ -16,6 +72,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["networking" "interfaces"];
|
name = ["networking" "interfaces"];
|
||||||
default = [];
|
default = [];
|
||||||
@ -33,6 +90,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["filesystems" "mountPoints"];
|
name = ["filesystems" "mountPoints"];
|
||||||
example = [
|
example = [
|
||||||
@ -48,6 +106,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["services" "syslogd" "tty"];
|
name = ["services" "syslogd" "tty"];
|
||||||
default = 10;
|
default = 10;
|
||||||
@ -57,6 +116,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["services" "mingetty" "ttys"];
|
name = ["services" "mingetty" "ttys"];
|
||||||
default = [1 2 3 4 5 6];
|
default = [1 2 3 4 5 6];
|
||||||
@ -66,6 +126,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["services" "mingetty" "waitOnMounts"];
|
name = ["services" "mingetty" "waitOnMounts"];
|
||||||
default = false;
|
default = false;
|
||||||
@ -77,6 +138,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["services" "sshd" "enable"];
|
name = ["services" "sshd" "enable"];
|
||||||
default = false;
|
default = false;
|
||||||
@ -86,6 +148,7 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
name = ["services" "sshd" "forwardX11"];
|
name = ["services" "sshd" "forwardX11"];
|
||||||
default = false;
|
default = false;
|
||||||
@ -94,4 +157,5 @@
|
|||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
let
|
let
|
||||||
|
|
||||||
# The root device.
|
configuration = {
|
||||||
rootDevice = "/dev/hda1";
|
boot = {
|
||||||
|
autoDetectRootDevice = false;
|
||||||
# The device on which GRUB should be installed (leave empty if you
|
rootDevice = "/dev/hda1";
|
||||||
# don't want GRUB to be installed).
|
readOnlyRoot = false;
|
||||||
grubDevice = "/dev/hda";
|
grubDevice = "/dev/hda";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# Build boot scripts.
|
# Build boot scripts.
|
||||||
bootEnv = import ./boot-environment.nix {
|
bootEnv = import ./boot-environment.nix {
|
||||||
autoDetectRootDevice = false;
|
|
||||||
inherit rootDevice;
|
|
||||||
stage2Init = ""; # Passed on the command line via Grub.
|
stage2Init = ""; # Passed on the command line via Grub.
|
||||||
readOnlyRoot = false;
|
inherit configuration;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Extra kernel command line arguments.
|
# Extra kernel command line arguments.
|
||||||
@ -34,12 +34,12 @@ rec {
|
|||||||
inherit upstartJobs;
|
inherit upstartJobs;
|
||||||
|
|
||||||
|
|
||||||
systemConfiguration = pkgs.stdenvNew.mkDerivation {
|
system = pkgs.stdenvNew.mkDerivation {
|
||||||
name = "system-configuration";
|
name = "system-configuration";
|
||||||
builder = ./system-configuration.sh;
|
builder = ./system-configuration.sh;
|
||||||
switchToConfiguration = ./switch-to-configuration.sh;
|
switchToConfiguration = ./switch-to-configuration.sh;
|
||||||
inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils;
|
inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils;
|
||||||
inherit grubDevice;
|
grubDevice = "/dev/hda"; # !!!
|
||||||
inherit bootStage2;
|
inherit bootStage2;
|
||||||
inherit activateConfiguration;
|
inherit activateConfiguration;
|
||||||
inherit grubMenuBuilder;
|
inherit grubMenuBuilder;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user