2021-08-05 12:33:13 -07:00
|
|
|
|
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="sec-bootloader-external">
|
|
|
|
|
<title>External Bootloader Backends</title>
|
|
|
|
|
<para>
|
|
|
|
|
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.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
You can replace the built-in bootloader support with your own
|
|
|
|
|
tooling using the <quote>external</quote> bootloader option.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
2022-12-01 16:24:33 -08:00
|
|
|
|
Imagine you have created a new package called FooBoot. FooBoot
|
2021-08-05 12:33:13 -07:00
|
|
|
|
provides a program at
|
|
|
|
|
<literal>${pkgs.fooboot}/bin/fooboot-install</literal> which takes
|
|
|
|
|
the system closure’s path as its only argument and configures the
|
|
|
|
|
system’s bootloader.
|
|
|
|
|
</para>
|
|
|
|
|
<para>
|
|
|
|
|
You can enable FooBoot like this:
|
|
|
|
|
</para>
|
2022-12-01 16:24:33 -08:00
|
|
|
|
<programlisting language="nix">
|
2021-08-05 12:33:13 -07:00
|
|
|
|
{ pkgs, ... }: {
|
|
|
|
|
boot.loader.external = {
|
|
|
|
|
enable = true;
|
|
|
|
|
installHook = "${pkgs.fooboot}/bin/fooboot-install";
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
</programlisting>
|
|
|
|
|
<section xml:id="developing-custom-bootloader-backends">
|
|
|
|
|
<title>Developing Custom Bootloader Backends</title>
|
|
|
|
|
<para>
|
|
|
|
|
Bootloaders should use
|
|
|
|
|
<link xlink:href="https://github.com/NixOS/rfcs/pull/125">RFC-0125</link>’s
|
|
|
|
|
Bootspec format and synthesis tools to identify the key properties
|
|
|
|
|
for bootable system generations.
|
|
|
|
|
</para>
|
|
|
|
|
</section>
|
|
|
|
|
</chapter>
|