3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/virtualisation
Bjørn Forsman 39fad297fd nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems
`nixos-rebuild build-vm-with-bootloader` currently fails with the
default NixOS EFI configuration:

  $ cat >configuration.nix <<EOF
  {
    fileSystems."/".device = "/dev/sda1";
    boot.loader.systemd-boot.enable = true;
    boot.loader.efi.canTouchEfiVariables = true;
  }
  EOF

  $ nixos-rebuild build-vm-with-bootloader -I nixos-config=$PWD/configuration.nix -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixos-20.09.tar.gz
  [...]
  insmod: ERROR: could not insert module /nix/store/1ibmgfr13r8b6xyn4f0wj115819f359c-linux-5.4.83/lib/modules/5.4.83/kernel/fs/efivarfs/efivarfs.ko.xz: No such device
  mount: /sys/firmware/efi/efivars: mount point does not exist.
  [    1.908328] reboot: Power down
  builder for '/nix/store/dx2ycclyknvibrskwmii42sgyalagjxa-nixos-boot-disk.drv' failed with exit code 32
  [...]

Fix it by setting virtualisation.useEFIBoot = true in qemu-vm.nix, when
efi is needed.

And remove the now unneeded configuration in
./nixos/tests/systemd-boot.nix, since it's handled globally.

Before:
* release-20.03: successful build, unsuccessful run
* release-20.09 (and master): unsuccessful build

After:
* Successful build and run.

Fixes https://github.com/NixOS/nixpkgs/issues/107255
2020-12-21 08:55:13 +01:00
..
amazon-image.nix utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
amazon-init.nix
amazon-options.nix
anbox.nix
azure-agent-entropy.patch
azure-agent.nix utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
azure-bootstrap-blobs.nix
azure-common.nix
azure-config-user.nix
azure-config.nix
azure-image.nix
azure-images.nix
brightbox-config.nix
brightbox-image.nix utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
cloudstack-config.nix
container-config.nix
containers.nix nixos/{containers,cri-o,podman}: move copyFile to nixos/lib/utils 2020-09-24 10:01:47 +10:00
cri-o.nix nixos/{containers,cri-o,podman}: move copyFile to nixos/lib/utils 2020-09-24 10:01:47 +10:00
digital-ocean-config.nix
digital-ocean-image.nix
digital-ocean-init.nix
docker-image.nix
docker.nix systemd: switch to unified cgroup hierarchy by default 2020-11-19 16:56:46 +01:00
ec2-amis.nix ec2-amis: update AMIs to use gpt partition table 2020-11-05 20:58:08 -05:00
ec2-data.nix
ec2-metadata-fetcher.nix {ec2,openstack}-metadata-fetcher: unconditionally fetch metadata 2020-11-22 11:04:46 +10:00
ecs-agent.nix
gce-images.nix
google-compute-config.nix
google-compute-image.nix
grow-partition.nix
hyperv-guest.nix
hyperv-image.nix
kvmgt.nix
libvirtd.nix
lxc-container.nix
lxc.nix Revert "apparmor: fix and improve the service" 2020-10-07 12:22:18 +02:00
lxcfs.nix
lxd.nix Revert "apparmor: fix and improve the service" 2020-10-07 12:22:18 +02:00
nixos-containers.nix nixos/*: fix indentation 2020-11-23 08:42:51 +10:00
oci-containers.nix
openstack-config.nix nixos: openstack: have its own metadata fetcher expression 2020-11-18 11:42:32 -05:00
openstack-metadata-fetcher.nix {ec2,openstack}-metadata-fetcher: unconditionally fetch metadata 2020-11-22 11:04:46 +10:00
openvswitch.nix
parallels-guest.nix
podman.nix nixos/{containers,cri-o,podman}: move copyFile to nixos/lib/utils 2020-09-24 10:01:47 +10:00
qemu-guest-agent.nix nixos/qemu-guest-agent: make the QEMU guest agent package configurable 2020-10-19 17:58:10 +02:00
qemu-vm.nix nixos: fix "nixos-rebuild build-vm-with-bootloader" for EFI systems 2020-12-21 08:55:13 +01:00
railcar.nix treewide: completely remove types.loaOf 2020-09-02 00:42:50 +02:00
spice-usb-redirection.nix fixup: address @jtojnar's review comments 2020-09-12 17:00:44 +02:00
vagrant-guest.nix nixos/vagrant-virtualbox-image: init (#101120) 2020-10-20 11:09:46 +02:00
vagrant-virtualbox-image.nix nixos/vagrant-virtualbox-image: init (#101120) 2020-10-20 11:09:46 +02:00
virtualbox-guest.nix
virtualbox-host.nix
virtualbox-image.nix
vmware-guest.nix
vmware-image.nix
xe-guest-utilities.nix
xen-dom0.nix utillinux: rename to util-linux 2020-11-24 12:42:06 -05:00
xen-domU.nix