1{
2 lib,
3 stdenv,
4 buildPackages,
5 fetchFromGitHub,
6 pciutils,
7 fwupd-efi,
8 ipxe,
9 refind,
10 syslinux,
11}:
12
13assert lib.assertMsg stdenv.hostPlatform.isEfi "gnu-efi may only be built for EFI platforms";
14
15stdenv.mkDerivation (finalAttrs: {
16 pname = "gnu-efi";
17 version = "4.0.2";
18
19 src = fetchFromGitHub {
20 owner = "ncroxon";
21 repo = "gnu-efi";
22 tag = finalAttrs.version;
23 hash = "sha256-oIj0aNY4xU5OcO69TTjh5FcWzzkFd6jbenwzVvTXjqo=";
24 };
25
26 buildInputs = [ pciutils ];
27
28 hardeningDisable = [ "stackprotector" ];
29
30 makeFlags = [
31 "PREFIX=\${out}"
32 "HOSTCC=${buildPackages.stdenv.cc.targetPrefix}cc"
33 "CROSS_COMPILE=${stdenv.cc.targetPrefix}"
34 ];
35
36 postPatch = ''
37 substituteInPlace Make.defaults \
38 --replace "-Werror" ""
39 '';
40
41 passthru.tests = {
42 inherit
43 fwupd-efi
44 syslinux
45 ;
46 };
47
48 meta = {
49 description = "GNU EFI development toolchain";
50 homepage = "https://github.com/ncroxon/gnu-efi";
51 license = with lib.licenses; [
52 # This is a mess, upstream is aware.
53 # The source for these is Fedora's SPDX identifier for this package.
54 # Fedora also has gpl2Only here, but 4.0.2 doesn't have gpl2Only code.
55 # However, both upstream and Fedora seems to have missed
56 # bsdAxisNoDisclaimerUnmodified and MIT.
57 bsd2
58 bsd2Patent
59 bsd3
60 bsdAxisNoDisclaimerUnmodified
61 bsdOriginal
62 gpl2Plus
63 mit
64 ];
65 platforms = lib.platforms.linux;
66 maintainers = with lib.maintainers; [ lzcunt ];
67 };
68})