* 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.
get = name:
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 =
if sameName == []
then abort ("Undeclared option `" + printName name + "'.")
else if !builtins.head sameName ? default
if !decl ? default
then abort ("Option `" + printName name + "' has no default.")
else (builtins.head sameName).default;
else decl.default;
in lib.getAttr name default config;
printName = name: lib.concatStrings (lib.intersperse "." name);

View File

@ -13,17 +13,8 @@
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.
device with the right label. If this option is off, then a root
file system must be specified using <option>filesystems</option>.
";
}
@ -150,17 +141,31 @@
{
name = ["filesystems" "mountPoints"];
name = ["filesystems"];
example = [
{ device = "/dev/hda2";
mountPoint = "/";
{ mountPoint = "/";
device = "/dev/hda1";
}
{ mountPoint = "/data";
device = "/dev/hda2";
filesystem = "ext3";
autoMount = true;
options = "data=journal";
}
];
description = "
The file systems to be mounted by NixOS. It must include an
entry for the root directory (<literal>mountPoint =
\"/\"</literal>). This is the file system on which NixOS is (to
be) installed..
The file systems to be mounted. It must include an entry for
the root directory (<literal>mountPoint = \"/\"</literal>).
Each entry in the list is an attribute set with the following
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 extraUtils;
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"];
inherit stage2Init;
modulesDir = modulesClosure;

View File

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