summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/cd-dvd/installation-cd-base.nix3
-rw-r--r--nixos/modules/installer/tools/nixos-generate-config.pl9
2 files changed, 12 insertions, 0 deletions
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-base.nix b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
index 89d50b7460c9..e453a629f74f 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-base.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-base.nix
@@ -45,6 +45,9 @@ with lib;
   # Add support for cow filesystems and their utilities
   boot.supportedFilesystems = [ /* "zfs" */ "btrfs" ];
 
+  # Configure host id for ZFS to work
+  networking.hostId = "8425e349";
+
   # Allow the user to log in as root without a password.
   users.extraUsers.root.initialHashedPassword = "";
 }
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.