lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 24.05-pre 110 lines 3.3 kB view raw
1{ stdenv, lib, fetchFromGitHub, unstableGitUpdater, buildPackages 2, gnu-efi, mtools, openssl, perl, xorriso, xz 3, syslinux ? null 4, embedScript ? null 5, additionalTargets ? {} 6, additionalOptions ? [] 7}: 8 9let 10 targets = additionalTargets // lib.optionalAttrs stdenv.isx86_64 { 11 "bin-x86_64-efi/ipxe.efi" = null; 12 "bin-x86_64-efi/ipxe.efirom" = null; 13 "bin-x86_64-efi/ipxe.usb" = "ipxe-efi.usb"; 14 } // lib.optionalAttrs stdenv.hostPlatform.isx86 { 15 "bin/ipxe.dsk" = null; 16 "bin/ipxe.usb" = null; 17 "bin/ipxe.iso" = null; 18 "bin/ipxe.lkrn" = null; 19 "bin/undionly.kpxe" = null; 20 } // lib.optionalAttrs stdenv.isAarch32 { 21 "bin-arm32-efi/ipxe.efi" = null; 22 "bin-arm32-efi/ipxe.efirom" = null; 23 "bin-arm32-efi/ipxe.usb" = "ipxe-efi.usb"; 24 } // lib.optionalAttrs stdenv.isAarch64 { 25 "bin-arm64-efi/ipxe.efi" = null; 26 "bin-arm64-efi/ipxe.efirom" = null; 27 "bin-arm64-efi/ipxe.usb" = "ipxe-efi.usb"; 28 }; 29in 30 31stdenv.mkDerivation rec { 32 pname = "ipxe"; 33 version = "unstable-2023-07-19"; 34 35 nativeBuildInputs = [ gnu-efi mtools openssl perl xorriso xz ] ++ lib.optional stdenv.hostPlatform.isx86 syslinux; 36 depsBuildBuild = [ buildPackages.stdenv.cc ]; 37 38 strictDeps = true; 39 40 src = fetchFromGitHub { 41 owner = "ipxe"; 42 repo = "ipxe"; 43 rev = "c1834f323f4f6b9b46cd5895b1457a117381363f"; 44 hash = "sha256-fJeDgm+OaItshWFliq08Y0BPDD2FCkezeEp7trqWNjA="; 45 }; 46 47 postPatch = lib.optionalString stdenv.hostPlatform.isAarch64 '' 48 substituteInPlace src/util/genfsimg --replace " syslinux " " true " 49 ''; # calling syslinux on a FAT image isn't going to work 50 51 # not possible due to assembler code 52 hardeningDisable = [ "pic" "stackprotector" ]; 53 54 env.NIX_CFLAGS_COMPILE = "-Wno-error"; 55 56 makeFlags = 57 [ "ECHO_E_BIN_ECHO=echo" "ECHO_E_BIN_ECHO_E=echo" # No /bin/echo here. 58 "CROSS=${stdenv.cc.targetPrefix}" 59 ] ++ lib.optional (embedScript != null) "EMBED=${embedScript}"; 60 61 62 enabledOptions = [ 63 "PING_CMD" 64 "IMAGE_TRUST_CMD" 65 "DOWNLOAD_PROTO_HTTP" 66 "DOWNLOAD_PROTO_HTTPS" 67 ] ++ additionalOptions; 68 69 configurePhase = '' 70 runHook preConfigure 71 for opt in ${lib.escapeShellArgs enabledOptions}; do echo "#define $opt" >> src/config/general.h; done 72 substituteInPlace src/Makefile.housekeeping --replace '/bin/echo' echo 73 '' + lib.optionalString stdenv.hostPlatform.isx86 '' 74 substituteInPlace src/util/genfsimg --replace /usr/lib/syslinux ${syslinux}/share/syslinux 75 '' + '' 76 runHook postConfigure 77 ''; 78 79 preBuild = "cd src"; 80 81 buildFlags = lib.attrNames targets; 82 83 installPhase = '' 84 runHook preInstall 85 86 mkdir -p $out 87 ${lib.concatStringsSep "\n" (lib.mapAttrsToList (from: to: 88 if to == null 89 then "cp -v ${from} $out" 90 else "cp -v ${from} $out/${to}") targets)} 91 92 # Some PXE constellations especially with dnsmasq are looking for the file with .0 ending 93 # let's provide it as a symlink to be compatible in this case. 94 ln -s undionly.kpxe $out/undionly.kpxe.0 95 96 runHook postInstall 97 ''; 98 99 enableParallelBuilding = true; 100 101 passthru.updateScript = unstableGitUpdater {}; 102 103 meta = with lib; 104 { description = "Network boot firmware"; 105 homepage = "https://ipxe.org/"; 106 license = licenses.gpl2Only; 107 maintainers = with maintainers; [ ehmry ]; 108 platforms = platforms.linux; 109 }; 110}