diff options
Diffstat (limited to 'nixos/modules/installer/tools/nixos-generate-config.pl')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index e8f100d64984..9abc1b4cc1b5 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -476,6 +476,14 @@ EOF EOF } + # Generate a random 32-bit value to use as the host id + open my $rnd, "<", "/dev/urandom" or die $!; + read $rnd, $hostIdBin, 4; + close $rnd; + + # Convert the 32-bit value to a hex string + my $hostIdHex = unpack("H*", $hostIdBin); + write_file($fn, <<EOF); # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page @@ -491,6 +499,7 @@ EOF $bootLoaderConfig # networking.hostName = "nixos"; # Define your hostname. + networking.hostId = "$hostIdHex"; # networking.wireless.enable = true; # Enables wireless. # Select internationalisation properties. |