Unverified Commit d979b453 authored by Luflosi's avatar Luflosi
Browse files

nixos/iso-image: avoid collision between GRUB2 versions

4b836fb6 added `pkgs.grub2_efi` to `environment.systemPackages` so that it would be in the Nix store and available for install. But `pkgs.grub2` is already in the list. This causes the various paths of the two GRUB2 versions to collide. To fix this, put `pkgs.grub2_efi` into `system.extraDependencies` instead. This should achieve the same effect of adding the second GRUB2 version to the Nix store without the paths colliding in the environment.

To reproduce the problem, execute `nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/iso-image.nix -A config.system.build.isoImage` and look for messages like
```
warning: collision between `/nix/store/9jk1p9n5dl431lcm4w9p6x6x8a00dm0q-grub-2.12/bin/grub-install' and `/nix/store/809l0i6aydg4zhn3kqf723brjyp2qm8h-grub-2.12/bin/grub-install'
```
parent 9b9ca770
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -772,9 +772,10 @@ in
    # here and it causes a cyclic dependency.
    boot.loader.grub.enable = false;

    environment.systemPackages =  [ grubPkgs.grub2 grubPkgs.grub2_efi ]
    environment.systemPackages =  [ grubPkgs.grub2 ]
      ++ lib.optional (config.isoImage.makeBiosBootable) pkgs.syslinux
    ;
    system.extraDependencies = [ grubPkgs.grub2_efi ];

    # In stage 1 of the boot, mount the CD as the root FS by label so
    # that we don't need to know its device.  We pass the label of the