\begin{Verbatim}[commandchars=\\\{\}] \PYZob{} pkgs ? import \PYZlt{}nixpkgs\PYZgt{} \PYZob{}\PYZcb{} , platformArch ? \PYZdq{}AARCH64\PYZdq{} , platformFile ? \PYZdq{}Platform/RaspberryPi/RPi3/RPi3.dsc\PYZdq{} , ... \PYZcb{}: let platform = if platformArch == \PYZdq{}AARCH64\PYZdq{} then \PYZdq{}aarch64\PYZhy{}multiplatform\PYZdq{} else if platformArch == \PYZdq{}ARM\PYZdq{} then \PYZdq{}armv7l\PYZhy{}hf\PYZhy{}multiplatform\PYZdq{} else if platformArch == \PYZdq{}IA32\PYZdq{} then \PYZdq{}gnu32\PYZdq{} else if platformArch == \PYZdq{}X64\PYZdq{} then \PYZdq{}gnu64\PYZdq{} else if platformArch == \PYZdq{}RISCV64\PYZdq{} then \PYZdq{}riscv64\PYZdq{} else builtins.throw \PYZdq{}Unknown platform architecture\PYZdq{}; platformPkgs = pkgs.pkgsCross.\PYZdl{}\PYZob{}platform\PYZcb{}; src = \PYZob{} edk2 = pkgs.fetchgit \PYZob{} url = \PYZdq{}https://github.com/tianocore/edk2.git\PYZdq{}; rev = \PYZdq{}dd5c7e3c5282b084daa5bbf0ec229cec699b2c17\PYZdq{}; sha256 = \PYZdq{}1m49m8z1448lmds3ypzipv2yayhayj3w7f0fashry8563zc85cpb\PYZdq{}; fetchSubmodules = true; \PYZcb{}; edk2\PYZhy{}platforms = pkgs.fetchgit \PYZob{} url = \PYZdq{}https://github.com/tianocore/edk2\PYZhy{}platforms.git\PYZdq{}; rev = \PYZdq{}4efd9ab2cfabdcbd6ca410f870bc889e76f18d85\PYZdq{}; sha256 = \PYZdq{}1mz8885scaksbkshab2sqwjxmblcy733l0qf1a8ixxjawa3rx7y9\PYZdq{}; fetchSubmodules = true; \PYZcb{}; edk2\PYZhy{}non\PYZhy{}osi = pkgs.fetchgit \PYZob{} url = \PYZdq{}https://github.com/tianocore/edk2\PYZhy{}non\PYZhy{}osi.git\PYZdq{}; rev = \PYZdq{}ff6750947db338c5a8be116c0d3dfef8ec3064ec\PYZdq{}; sha256 = \PYZdq{}1844jsm2dafy4f70srgb3k1jpfx7xc70snjp30qzi74bcyka05l6\PYZdq{}; fetchSubmodules = true; \PYZcb{}; \PYZcb{}; in platformPkgs.stdenv.mkDerivation rec \PYZob{} pname = \PYZdq{}edk2\PYZhy{}platform\PYZhy{}\PYZdl{}\PYZob{}with builtins; head (split \PYZdq{}\PYZbs{}\PYZbs{}.\PYZdq{} (baseNameOf platformFile))\PYZcb{}\PYZdq{}; version = \PYZdq{}4efd9ab\PYZdq{}; srcs = builtins.attrValues src; depsBuildBuild = with pkgs; [ gcc utillinux python iasl openssl ]; unpackPhase = \PYZsq{}\PYZsq{} mkdir \PYZhy{}p \PYZdl{}out cp \PYZhy{}r \PYZdl{}\PYZob{}src.edk2\PYZcb{} \PYZdl{}out/edk2 cp \PYZhy{}r \PYZdl{}\PYZob{}src.edk2\PYZhy{}platforms\PYZcb{} \PYZdl{}out/edk2\PYZhy{}platforms cp \PYZhy{}r \PYZdl{}\PYZob{}src.edk2\PYZhy{}non\PYZhy{}osi\PYZcb{} \PYZdl{}out/edk2\PYZhy{}non\PYZhy{}osi chmod \PYZhy{}R u+w \PYZdl{}out cd \PYZdl{}out \PYZsq{}\PYZsq{}; NIX\PYZus{}CFLAGS\PYZus{}COMPILE = \PYZdq{}\PYZhy{}Wno\PYZhy{}format \PYZhy{}Wno\PYZhy{}format\PYZhy{}security\PYZdq{}; patches = [ ./rnglib.patch ]; patchFlags = [ \PYZdq{}\PYZhy{}\PYZhy{}strip=1\PYZdq{} \PYZdq{}\PYZhy{}\PYZhy{}directory=edk2\PYZhy{}platforms\PYZdq{} ]; postPatch = \PYZdq{}patchShebangs .\PYZdq{}; configurePhase = \PYZsq{}\PYZsq{} export WORKSPACE=\PYZdl{}PWD export PACKAGES\PYZus{}PATH=\PYZdl{}PWD/edk2:\PYZdl{}PWD/edk2\PYZhy{}platforms:\PYZdl{}PWD/edk2\PYZhy{}non\PYZhy{}osi export GCC5\PYZus{}\PYZdl{}\PYZob{}platformArch\PYZcb{}\PYZus{}PREFIX=\PYZdq{}\PYZdl{}\PYZob{}pkgs.lib.systems.examples.\PYZdl{}\PYZob{}platform\PYZcb{}.config\PYZcb{}\PYZhy{}\PYZdq{} . edk2/edksetup.sh \PYZsq{}\PYZsq{}; buildPhase = \PYZsq{}\PYZsq{} make \PYZhy{}C edk2/BaseTools build \PYZhy{}n \PYZdl{}NIX\PYZus{}BUILD\PYZus{}CORES \PYZhy{}b RELEASE \PYZhy{}a \PYZdl{}\PYZob{}platformArch\PYZcb{} \PYZhy{}t GCC5 \PYZhy{}p \PYZdl{}\PYZob{}platformFile\PYZcb{} \PYZsq{}\PYZsq{}; dontInstall = true; dontFixup = true; \PYZcb{} \end{Verbatim}