nixpkgs/nixos/modules/system/boot/loader/external/external.md
pennae dc7788efb8 nixos/manual: regenerate chapter xml files
apparently pandoc has changed behavior over the past releases, so the
files are no longer in sync. occasionally this requires edits
to the markdown source to not remove an anchor that was there
before (albeit wth a very questionable id), or where things were simply
being misrendered due to syntax errors.
2023-01-10 10:31:59 +01:00

1.1 KiB

External Bootloader Backends

NixOS has support for several bootloader backends by default: systemd-boot, grub, uboot, etc. The built-in bootloader backend support is generic and supports most use cases. Some users may prefer to create advanced workflows around managing the bootloader and bootable entries.

You can replace the built-in bootloader support with your own tooling using the "external" bootloader option.

Imagine you have created a new package called FooBoot. FooBoot provides a program at ${pkgs.fooboot}/bin/fooboot-install which takes the system closure's path as its only argument and configures the system's bootloader.

You can enable FooBoot like this:

{ pkgs, ... }: {
  boot.loader.external = {
    enable = true;
    installHook = "${pkgs.fooboot}/bin/fooboot-install";
  };
}

Developing Custom Bootloader Backends

Bootloaders should use RFC-0125's Bootspec format and synthesis tools to identify the key properties for bootable system generations.