nixos/uki: allow deviceTree to be excluded from UKI

When setting `hardware.deviceTree.name` and `.enable`, a DeviceTree
section is added to UKI. This is nice default behavior for arm64
systems. When `hardware.deviceTree.package` plumbs into UEFI firmware
(e.g. u-boot), the UKI replaces the UEFI-supplied DTB. Besides bloating
the UKI, this has the side-effect of preventing UEFI firmware from
making modifications to the devicetree.

Filter out null boot.uki.settings values so that a NixOS configuration
can set `boot.uki.settings.UKI.DeviceTree = null;` to remove the default
behavior of packing the dtb into the UKI.

(cherry picked from commit e949e86001)
This commit is contained in:
Elliot Berman
2026-07-28 13:11:20 -07:00
committed by github-actions[bot]
parent 18fb21044e
commit f76797e02a

View File

@@ -12,6 +12,8 @@ let
inherit (pkgs.stdenv.hostPlatform) efiArch;
format = pkgs.formats.ini { };
ukiSettings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings;
in
{
@@ -94,7 +96,7 @@ in
};
};
boot.uki.configFile = lib.mkOptionDefault (format.generate "ukify.conf" cfg.settings);
boot.uki.configFile = lib.mkOptionDefault (format.generate "ukify.conf" ukiSettings);
system.boot.loader.ukiFile =
let