* Removed boot.rootDevice, instead obtain the root device from the

filesystems option (specifically the file system with mountPoint ==
  "/").

svn path=/nixos/trunk/; revision=7447
This commit is contained in:
Eelco Dolstra 2006-12-21 00:16:20 +00:00
parent f9d67afce0
commit e060b99c52
4 changed files with 40 additions and 25 deletions

View File

@ -15,13 +15,14 @@ rec {
# its default value if it's not defined. # its default value if it's not defined.
get = name: get = name:
let let
sameName = lib.filter (opt: lib.eqLists opt.name name) declarations; decl =
lib.findSingle (decl: lib.eqLists decl.name name)
(abort ("Undeclared option `" + printName name + "'."))
declarations;
default = default =
if sameName == [] if !decl ? default
then abort ("Undeclared option `" + printName name + "'.")
else if !builtins.head sameName ? default
then abort ("Option `" + printName name + "' has no default.") then abort ("Option `" + printName name + "' has no default.")
else (builtins.head sameName).default; else decl.default;
in lib.getAttr name default config; in lib.getAttr name default config;
printName = name: lib.concatStrings (lib.intersperse "." name); printName = name: lib.concatStrings (lib.intersperse "." name);

View File

@ -13,17 +13,8 @@
default = false; default = false;
description = " description = "
Whether to find the root device automatically by searching for a Whether to find the root device automatically by searching for a
device with the right label. If this option is off, then device with the right label. If this option is off, then a root
<option>boot.rootDevice</option> must be set. file system must be specified using <option>filesystems</option>.
";
}
{
name = ["boot" "rootDevice"];
example = "/dev/hda1";
description = "
The device to be mounted on / at system startup.
"; ";
} }
@ -150,17 +141,31 @@
{ {
name = ["filesystems" "mountPoints"]; name = ["filesystems"];
example = [ example = [
{ device = "/dev/hda2"; { mountPoint = "/";
mountPoint = "/"; device = "/dev/hda1";
}
{ mountPoint = "/data";
device = "/dev/hda2";
filesystem = "ext3";
autoMount = true;
options = "data=journal";
} }
]; ];
description = " description = "
The file systems to be mounted by NixOS. It must include an The file systems to be mounted. It must include an entry for
entry for the root directory (<literal>mountPoint = the root directory (<literal>mountPoint = \"/\"</literal>).
\"/\"</literal>). This is the file system on which NixOS is (to Each entry in the list is an attribute set with the following
be) installed.. fields: <literal>mountPoint</literal>,
<literal>device</literal>, <literal>filesystem</literal> (a file
system type recognised by <command>mount</command>; defaults to
<literal>\"auto\"</literal>), <literal>autoMount</literal> (a
boolean indicating whether the file system is mounted
automatically; defaults to <literal>true</literal>) and
<literal>options</literal> (the mount options passed to
<command>mount</command> using the <option>-o</option> flag;
defaults to <literal>\"\"</literal>).
"; ";
} }

View File

@ -73,7 +73,10 @@ rec {
inherit (pkgsDiet) module_init_tools; inherit (pkgsDiet) module_init_tools;
inherit extraUtils; inherit extraUtils;
autoDetectRootDevice = config.get ["boot" "autoDetectRootDevice"]; autoDetectRootDevice = config.get ["boot" "autoDetectRootDevice"];
rootDevice = config.get ["boot" "rootDevice"]; rootDevice =
(pkgs.library.findSingle (fs: fs.mountPoint == "/")
(abort "No root mount point declared.")
(config.get ["filesystems"])).device;
rootLabel = config.get ["boot" "rootLabel"]; rootLabel = config.get ["boot" "rootLabel"];
inherit stage2Init; inherit stage2Init;
modulesDir = modulesClosure; modulesDir = modulesClosure;

View File

@ -1,10 +1,16 @@
{ {
boot = { boot = {
autoDetectRootDevice = false; autoDetectRootDevice = false;
rootDevice = "/dev/hda1";
readOnlyRoot = false; readOnlyRoot = false;
grubDevice = "/dev/hda"; grubDevice = "/dev/hda";
}; };
filesystems = [
{ mountPoint = "/";
device = "/dev/hda1";
}
];
services = { services = {
sshd = { sshd = {
enable = true; enable = true;