summary refs log tree commit diff
path: root/nixos/modules/installer/tools/nixos-generate-config.pl
diff options
context:
space:
mode:
authorwmertens <Wout.Mertens@gmail.com>2014-11-13 10:26:30 +0100
committerwmertens <Wout.Mertens@gmail.com>2014-11-13 10:26:30 +0100
commit5c19521c6e3b79ae42ab928494490876a9c47a27 (patch)
tree9d10862d5ea8d1a26f65d81780fa4e4c0338268b /nixos/modules/installer/tools/nixos-generate-config.pl
parentcd6bb77a9e420291c329aaff0fbe11e870621be0 (diff)
parent7a7bf8368e25d13b1f2e915514c804728b7648ef (diff)
downloadnixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.tar
nixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.tar.gz
nixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.tar.bz2
nixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.tar.lz
nixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.tar.xz
nixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.tar.zst
nixlib-5c19521c6e3b79ae42ab928494490876a9c47a27.zip
Merge pull request #4807 from wizeman/u/zfs-improvements
ZFS improvements
Diffstat (limited to 'nixos/modules/installer/tools/nixos-generate-config.pl')
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl9
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.