diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2024-06-12 08:15:16 +0200 |
---|---|---|
committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2024-06-24 13:40:51 +0000 |
commit | c902526b898c8aa633dbaa09e4d340a03829aa18 (patch) | |
tree | ae876c695fc60e7d112559f2813a0d92133b86d2 | |
parent | ff5faae57ce4b54fda0f053236f56b3a129f57b3 (diff) |
make-disk-image: fix build for systems that use boot.loader.grub.devices
config.boot.loader.grub.device is just an alias that gets assigned to config.boot.loader.grub.devices. If config.boot.loader.grub.device is set to null, it will fail with the following error as described in https://github.com/nix-community/nixos-generators/issues/339 (cherry picked from commit d0126c0508e46fff6b7560f60f2d9e9f1067b096)
-rw-r--r-- | nixos/lib/make-disk-image.nix | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/nixos/lib/make-disk-image.nix b/nixos/lib/make-disk-image.nix index 9bdbf4e0713de..1220bbfd5ed7c 100644 --- a/nixos/lib/make-disk-image.nix +++ b/nixos/lib/make-disk-image.nix @@ -603,10 +603,11 @@ let format' = format; in let ${lib.optionalString installBootLoader '' # In this throwaway resource, we only have /dev/vda, but the actual VM may refer to another disk for bootloader, e.g. /dev/vdb # Use this option to create a symlink from vda to any arbitrary device you want. - ${optionalString (config.boot.loader.grub.enable && config.boot.loader.grub.device != "/dev/vda") '' - mkdir -p $(dirname ${config.boot.loader.grub.device}) - ln -s /dev/vda ${config.boot.loader.grub.device} - ''} + ${optionalString (config.boot.loader.grub.enable) (lib.concatMapStringsSep " " (device: + lib.optionalString (device != "/dev/vda") '' + mkdir -p "$(dirname ${device})" + ln -s /dev/vda ${device} + '') config.boot.loader.grub.devices)} # Set up core system link, bootloader (sd-boot, GRUB, uboot, etc.), etc. |