[Solved] Unable to change bootloader from systemd to grub


I want to change from systemd boot loader to Grub 2, so I updated my config from

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

to the following:

  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.device = "nodev";
  boot.loader.grub.efiSupport = true;

I then ran nixos-rebuild --install-bootloader boot

However, the system still boots with systemd bootloader. How can I fix this?

Found the error - i should not have removed the line:

boot.loader.efi.canTouchEfiVariables = true;