nixos: provide /etc/hostname
/etc/hostname is the file used by hostnamectl(1) and the org.freedesktop.hostname1 dbus service (both provided by systemd) to get the "static hostname". Better provide it so that users of those tools/services get a proper hostname. An example of an issue created by the lack of /etc/hostname is that the bluetooth stack on NixOS identifies itself to peers as "BlueZ $VERSION" instead of the hostname. References: https://www.freedesktop.org/software/systemd/man/hostname.html Changes v1 -> v2: * ensure /etc/hostname ends with a newline
This commit is contained in:
parent
49d444416c
commit
cb9195b7bc
|
@ -921,6 +921,13 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
# static hostname configuration needed for hostnamectl and the
|
||||
# org.freedesktop.hostname1 dbus service (both provided by systemd)
|
||||
environment.etc."hostname" = mkIf (cfg.hostName != "")
|
||||
{
|
||||
text = cfg.hostName + "\n";
|
||||
};
|
||||
|
||||
environment.systemPackages =
|
||||
[ pkgs.host
|
||||
pkgs.iproute
|
||||
|
|
Loading…
Reference in New Issue