Installing NixOS on a system without EFI and the bootloader on a different hard disk

I got a small server from HP (Proliant Gen8). The installation preconditions are a bit special:

It has 5 SATA ports (4 for the drive bays and one for a optical drive) but the BIOS (no EFI) can’t boot from the optical drive for some reason. However, there’s an internal SD-Card reader which can be used for boot. I don’t want to install the whole OS on the SD-Card for obvious reasons but just writing the bootloader should be fine. I don’t want to write the bootloader on any of the other SATA disks because they should be dedicated to storage.

Considering these conditions I came up with following configuration for the NixOS installation (only the boot part):

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  boot.loader.grub.enable = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.devices = [
    "/dev/disk/by-id/usb-HP_iLO_Internal_SD-CARD_000002660A01-0:0"
  ];

  boot.initrd = {
    luks.devices = [
      {
        name = "root";
        device = "/dev/disk/by-uuid/94796159-5d55-417c-bdda-e9d482e19c71";
        preLVM = true;
        allowDiscards = true;
      }
    ];
  };
  fileSystems."/".options = [ "noatime" "nodiratime" ];

The installation works fine but after a reboot, the BIOS can’t detect any bootable system. For the whole installation I followed this guide but without the EFI part: Installation of NixOS with encrypted root · GitHub

Have you installed anything from SD card before?

Yes I already installed CentOS 4 years ago using by using the SD-Card for the bootloader. But I can’t remember how I did it exactly and I’m not experienced with NixOS yet.

How do you currently boot into the Nix installer? (If you’re using a bootable media at all?)

I use a USB storage which I set as temporary boot media in the BIOS.

I’d start by verifying if the sd card can be used for boot at all. Try to copy installation media on the sd card first? Your config seems fine

I have a dl380 g7 myself, and while most folks install esxi on the sdcard, I also choose not to use it. Mostly due to having to keep the nix store in the root and to date I never had a sdcard that lasted very long. I use one of the SAS disks to boot the beast, and my nix configuration is straightforward.

Update for the sake of documentation: The partition on the SD card was not marked as bootable. You have to do this manually. For some reason I thought the NixOS install would do that for me or would at least warn me if I try to install Grub on a non-bootable partition.

1 Like