From 56c5efa25b51e4a1b8452ef2adb18d96dadfb323 Mon Sep 17 00:00:00 2001 From: talyz Date: Tue, 5 Oct 2021 15:50:04 +0200 Subject: [PATCH] make-disk-image: Reintroduce the installBootLoader argument installBootLoader was removed in f1708a9d7d79e2bf2961fc648625578b23b3460f; probably by mistake, since only the logic was removed, not the argument. --- nixos/lib/make-disk-image.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/nixos/lib/make-disk-image.nix b/nixos/lib/make-disk-image.nix index 55643facea03..63dd5594af30 100644 --- a/nixos/lib/make-disk-image.nix +++ b/nixos/lib/make-disk-image.nix @@ -44,6 +44,9 @@ # most likely fails as GRUB will probably refuse to install. partitionTableType ? "legacy" +, # Whether to invoke `switch-to-configuration boot` during image creation + installBootLoader ? true + , # The root file system type. fsType ? "ext4" @@ -368,11 +371,13 @@ in pkgs.vmTools.runInLinuxVM ( cp ${configFile} /mnt/etc/nixos/configuration.nix ''} - # Set up core system link, GRUB, etc. - NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot + ${lib.optionalString installBootLoader '' + # Set up core system link, GRUB, etc. + NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot - # The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images - rm -f $mountPoint/etc/machine-id + # The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images + rm -f $mountPoint/etc/machine-id + ''} # Set the ownerships of the contents. The modes are set in preVM. # No globbing on targets, so no need to set -f