Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions doc/stdenv/platform-notes.chapter.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Platform Notes {#chap-platform-notes}

## UEFI {#sec-uefi}

Some common issues when packaging software for UEFI environments:

- Not all compilers know about UEFI as a proper target.

Most software will offer ways to compile UEFI software as it was compiled for the host system (not the UEFI host system) which will either confuse nixpkgs, you, or will be a hack.

Examples of such software are GNU GRUB (GNU-EFI), systemd-boot (elf2efi) and EDK2 firmware (bespoke build scripts)

- Nixpkgs cannot know if you have UEFI firmware support or not on your platform beyond what is declared to be supported.

Use `pkgs.stdenv.hostPlatform.hasEfi` to know if it potentially have any form of UEFI support.

## Darwin (macOS) {#sec-darwin}

Some common issues when packaging software for Darwin:
Expand Down
8 changes: 7 additions & 1 deletion lib/systems/inspect.nix
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,19 @@ rec {
isMusl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf muslabin32 muslabi64 ];
isUClibc = with abis; map (a: { abi = a; }) [ uclibc uclibceabi uclibceabihf ];

isEfi = [
# This is the list of platforms which can potentially have a UEFI firmware
# This is helpful to know when to emit UEFI binaries along your software, e.g. for boot or more.
hasEfi = [
{ cpu = { family = "arm"; version = "6"; }; }
{ cpu = { family = "arm"; version = "7"; }; }
{ cpu = { family = "arm"; version = "8"; }; }
{ cpu = { family = "riscv"; }; }
{ cpu = { family = "x86"; }; }
];

# This name will soon be used for detection of the UEFI target itself.
# Start deprecation of this in NixOS 24.05
isEfi = hasEfi;
};

matchAnyAttrs = patterns:
Expand Down
2 changes: 1 addition & 1 deletion pkgs/os-specific/linux/systemd/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
, withCryptsetup ? true
, withRepart ? true
, withDocumentation ? true
, withEfi ? stdenv.hostPlatform.isEfi
, withEfi ? stdenv.hostPlatform.hasEfi
, withFido2 ? true
, withFirstboot ? false # conflicts with the NixOS /etc management
, withHomed ? !stdenv.hostPlatform.isMusl
Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21796,7 +21796,7 @@ with pkgs;

gnu-config = callPackage ../development/libraries/gnu-config { };

gnu-efi = if stdenv.hostPlatform.isEfi
gnu-efi = if stdenv.hostPlatform.hasEfi
then callPackage ../development/libraries/gnu-efi { }
else null;

Expand Down