mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-04 03:03:42 +00:00
* User configuration: use the `networking.hostname' option to
configure the host name. svn path=/nixu/trunk/; revision=7150
This commit is contained in:
parent
67bada0886
commit
1a0fcfdf1a
@ -183,8 +183,7 @@ rec {
|
||||
# everything else to bring up the system.
|
||||
bootStage2 = import ./boot-stage-2.nix {
|
||||
inherit (pkgs) genericSubstituter coreutils findutils
|
||||
utillinux kernel udev
|
||||
upstart;
|
||||
utillinux kernel udev upstart;
|
||||
inherit upstartJobs;
|
||||
shell = pkgs.bash + "/bin/sh";
|
||||
|
||||
@ -218,6 +217,42 @@ rec {
|
||||
];
|
||||
|
||||
inherit readOnlyRoot;
|
||||
|
||||
hostName = config.get ["networking" "hostname"];
|
||||
};
|
||||
|
||||
|
||||
lib = import ./pkgs/lib;
|
||||
|
||||
|
||||
config = rec {
|
||||
|
||||
# The user configuration.
|
||||
config = {
|
||||
networking = {
|
||||
hostname = "vindaloo";
|
||||
};
|
||||
};
|
||||
|
||||
# The option declarations, i.e., option names with defaults and
|
||||
# documentation.
|
||||
declarations = import ./options.nix;
|
||||
|
||||
# Get the option named `name' from the user configuration, using
|
||||
# its default value if it's not defined.
|
||||
get = name:
|
||||
let
|
||||
sameName = lib.filter (opt: lib.eqLists opt.name name) declarations;
|
||||
default =
|
||||
if sameName == []
|
||||
then abort ("Undeclared option `" + printName name + "'.")
|
||||
else if !builtins.head sameName ? default
|
||||
then abort ("Option `" + printName name + "' has no default.")
|
||||
else (builtins.head sameName).default;
|
||||
in lib.getAttr name default config;
|
||||
|
||||
printName = name: lib.concatStrings (lib.intersperse "." name);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -157,7 +157,7 @@ EOF
|
||||
|
||||
|
||||
# Set the host name.
|
||||
hostname nixos
|
||||
hostname @hostName@
|
||||
|
||||
|
||||
# Start an interactive shell.
|
||||
|
@ -8,12 +8,14 @@
|
||||
|
||||
, # The Upstart job configuration.
|
||||
upstartJobs
|
||||
|
||||
, hostName
|
||||
}:
|
||||
|
||||
genericSubstituter {
|
||||
src = ./boot-stage-2-init.sh;
|
||||
isExecutable = true;
|
||||
inherit shell kernel upstart readOnlyRoot upstartJobs;
|
||||
inherit shell kernel upstart readOnlyRoot upstartJobs hostName;
|
||||
path = [
|
||||
coreutils
|
||||
findutils
|
||||
|
@ -1,22 +1,22 @@
|
||||
[
|
||||
[
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["networking" "hostname"];
|
||||
default = "nixos";
|
||||
description = "The name of the machine."
|
||||
})
|
||||
description = "The name of the machine.";
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["networking" "useDHCP"];
|
||||
default = true;
|
||||
description = "
|
||||
Whether to use DHCP to obtain an IP adress and other
|
||||
configuration for all network interfaces that are not manually
|
||||
configured.
|
||||
"
|
||||
})
|
||||
";
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["networking" "interfaces"];
|
||||
default = [];
|
||||
example = [
|
||||
@ -30,10 +30,10 @@
|
||||
The configuration for each network interface. If
|
||||
<option>networking.useDHCP</option> is true, then each interface
|
||||
not listed here will be configured using DHCP.
|
||||
"
|
||||
})
|
||||
";
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["filesystems" "mountPoints"];
|
||||
example = [
|
||||
{ device = "/dev/hda2";
|
||||
@ -46,27 +46,27 @@
|
||||
\"/\"</literal>). This is the file system on which NixOS is (to
|
||||
be) installed..
|
||||
";
|
||||
})
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["services" "syslogd" "tty"];
|
||||
default = 10;
|
||||
description = "
|
||||
The tty device on which syslogd will print important log
|
||||
messages.
|
||||
";
|
||||
})
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["services" "mingetty" "ttys"];
|
||||
default = [1 2 3 4 5 6];
|
||||
description = "
|
||||
The list of tty (virtual console) devices on which to start a
|
||||
login prompt.
|
||||
";
|
||||
})
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["services" "mingetty" "waitOnMounts"];
|
||||
default = false;
|
||||
description = "
|
||||
@ -75,23 +75,23 @@
|
||||
default we don't wait, but if for example your /home is on a
|
||||
separate partition, you may want to turn this on.
|
||||
";
|
||||
})
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["services" "sshd" "enable"];
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable the Secure Shell daemon, which allows secure
|
||||
remote logins.
|
||||
";
|
||||
})
|
||||
}
|
||||
|
||||
(option {
|
||||
{
|
||||
name = ["services" "sshd" "forwardX11"];
|
||||
default = false;
|
||||
description = "
|
||||
Whether to enable sshd to forward X11 connections.
|
||||
";
|
||||
})
|
||||
}
|
||||
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user