From 3aff7b471c61b26a0be6f1bdc35ee8871d0168b7 Mon Sep 17 00:00:00 2001 From: Ben Wolsieffer Date: Mon, 28 Apr 2025 21:21:19 -0400 Subject: [PATCH] linux/common-config: enable EFI on supported platforms Currently, is it possible for stdenv.hostPlatform.isEfi to be true but the kernel to have no EFI support. This mainly occurs on armv6l and causes systemd in initrd to fail to build because it attempts to include the non-existent efivarfs module in the initrd. To fix this, automatically enable CONFIG_EFI on platforms where isEfi is true. An alternative would be to make isEfi false on armv6l, but EFI is in fact usable on that platform. To prove this, I successfully booted NixOS on a Raspberry Pi Zero using systemd-boot and U-Boot's EFI support. I confirmed that efivarfs works as well. --- pkgs/os-specific/linux/kernel/common-config.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index 0c5ee542de44..42653d4ef3b3 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -1165,6 +1165,7 @@ let DVB_DYNAMIC_MINORS = option yes; # we use udev + EFI = lib.mkIf stdenv.hostPlatform.isEfi yes; EFI_STUB = yes; # EFI bootloader in the bzImage itself EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER = whenOlder "6.2" (whenAtLeast "5.8" yes); # initrd kernel parameter for EFI