Create a udev rule for /dev/root

In the installation CD, this ensures that systemd will see a proper
udev node for /dev/root.

Fixes #4399.

Borrowed from

http://lists.freedesktop.org/archives/systemd-devel/2014-July/020988.html

+8 -3
+8
nixos/modules/system/boot/stage-1-init.sh
··· 368 368 @postMountCommands@ 369 369 370 370 371 + # Emit a udev rule for /dev/root to prevent systemd from complaining. 372 + eval $(udevadm info --export --export-prefix=ROOT_ --device-id-of-file=$targetRoot || true) 373 + if [ "$ROOT_MAJOR" -a "$ROOT_MINOR" -a "$ROOT_MAJOR" != 0 ]; then 374 + mkdir -p /run/udev/rules.d 375 + echo 'ACTION=="add|change", SUBSYSTEM=="block", ENV{MAJOR}=="'$ROOT_MAJOR'", ENV{MINOR}=="'$ROOT_MINOR'", SYMLINK+="root"' > /run/udev/rules.d/61-dev-root-link.rules 376 + fi 377 + 378 + 371 379 # Stop udevd. 372 380 udevadm control --exit || true 373 381
-3
nixos/modules/system/boot/stage-1.nix
··· 346 346 (isYes "BLK_DEV_INITRD") 347 347 ]; 348 348 349 - # Prevent systemd from waiting for the /dev/root symlink. 350 - systemd.units."dev-root.device".text = ""; 351 - 352 349 boot.initrd.supportedFilesystems = map (fs: fs.fsType) fileSystems; 353 350 354 351 };