3
0
Fork 0
forked from mirrors/nixpkgs

Allow the hostname to be empty (to obtain it using dhcp).

svn path=/nixos/trunk/; revision=9857
This commit is contained in:
Eelco Dolstra 2007-12-04 15:02:48 +00:00
parent d987b16112
commit becb4b69c1
2 changed files with 16 additions and 3 deletions

View file

@ -119,6 +119,7 @@ mkdir -m 1777 -p /nix/var/nix/gcroots/per-user
mkdir -m 0755 -p /nix/var/nix/temproots
mkdir -m 0755 -p /nix/var/nix/profiles
mkdir -m 1777 -p /nix/var/nix/profiles/per-user
mkdir -m 0755 -p /nix/var/nix/channel-cache
ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/
ln -sf /nix/var/nix/manifests /nix/var/nix/gcroots/
@ -138,8 +139,17 @@ for i in @setuidPrograms@; do
done
# Set the host name.
hostname @hostName@
# Set the host name. Don't clear it if it's not configured in the
# NixOS configuration, since it may have been set by dhclient in the
# meantime.
if test -n "@hostName@"; then
hostname @hostName@
else
# dhclient won't do anything if the hostname isn't empty.
if test "$(hostname)" = "(none)"; then
hostname ''
fi
fi
# Make this configuration the current configuration.

View file

@ -216,7 +216,10 @@
hostName = mkOption {
default = "nixos";
description = "The name of the machine.";
description = "
The name of the machine. Leave it empty if you want to obtain
it from a DHCP server (if using DHCP).
";
};
extraHosts = mkOption {