Skip to content

Commit

Permalink
Merge #325403: edk2: 202405 -> 202402 (downgrade)
Browse files Browse the repository at this point in the history
  • Loading branch information
vcunat committed Jul 8, 2024
2 parents 3cad140 + 30ef8b6 commit 655f80c
Showing 1 changed file with 38 additions and 19 deletions.
57 changes: 38 additions & 19 deletions pkgs/by-name/ed/edk2/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
, bc
, lib
, buildPackages
, nix-update-script
, nixosTests
, runCommand
, writeScript
}:

let
Expand All @@ -29,9 +31,9 @@ buildType = if stdenv.isDarwin then
else
"GCC5";

edk2 = stdenv.mkDerivation {
edk2 = stdenv.mkDerivation rec {
pname = "edk2";
version = "202405";
version = "202402";

patches = [
# pass targetPrefix as an env var
Expand All @@ -46,27 +48,29 @@ edk2 = stdenv.mkDerivation {
})
];

src = fetchFromGitHub {
srcWithVendoring = fetchFromGitHub {
owner = "tianocore";
repo = "edk2";
rev = "edk2-stable${edk2.version}";
fetchSubmodules = true;
hash = "sha256-7vNodHocwqQiO0ZXtqo8lEOFyt8JkFHcAathEhrKWE0=";

# We don't want EDK2 to keep track of OpenSSL,
# they're frankly bad at it.
postFetch = ''
rm -rf $out/CryptoPkg/Library/OpensslLib/openssl
mkdir -p $out/CryptoPkg/Library/OpensslLib/openssl
tar --strip-components=1 -xf ${buildPackages.openssl.src} -C $out/CryptoPkg/Library/OpensslLib/openssl
# Fix missing INT64_MAX include that edk2 explicitly does not provide
# via it's own <stdint.h>. Let's pull in openssl's definition instead:
sed -i $out/CryptoPkg/Library/OpensslLib/openssl/crypto/property/property_parse.c \
-e '1i #include "internal/numbers.h"'
'';
hash = "sha256-Nurm6QNKCyV6wvbj0ELdYAL7mbZ0yg/tTwnEJ+N18ng=";
};

# We don't want EDK2 to keep track of OpenSSL,
# they're frankly bad at it.
src = runCommand "edk2-unvendored-src" { } ''
cp --no-preserve=mode -r ${srcWithVendoring} $out
rm -rf $out/CryptoPkg/Library/OpensslLib/openssl
mkdir -p $out/CryptoPkg/Library/OpensslLib/openssl
tar --strip-components=1 -xf ${buildPackages.openssl.src} -C $out/CryptoPkg/Library/OpensslLib/openssl
chmod -R +w $out/
# Fix missing INT64_MAX include that edk2 explicitly does not provide
# via it's own <stdint.h>. Let's pull in openssl's definition instead:
sed -i $out/CryptoPkg/Library/OpensslLib/openssl/crypto/property/property_parse.c \
-e '1i #include "internal/numbers.h"'
'';

nativeBuildInputs = [ pythonEnv ];
depsBuildBuild = [ buildPackages.stdenv.cc buildPackages.bash ];
depsHostHost = [ libuuid ];
Expand Down Expand Up @@ -105,7 +109,22 @@ edk2 = stdenv.mkDerivation {
};

passthru = {
updateScript = nix-update-script { };
# exercise a channel blocker
tests.uefiUsb = nixosTests.boot.uefiCdrom;

updateScript = writeScript "update-edk2" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p common-updater-scripts coreutils gnused
set -eu -o pipefail
version="$(list-git-tags --url="${edk2.srcWithVendoring.url}" |
sed -E --quiet 's/^edk2-stable([0-9]{6})$/\1/p' |
sort --reverse --numeric-sort |
head -n 1)"
if [[ "x$UPDATE_NIX_OLD_VERSION" != "x$version" ]]; then
update-source-version --source-key=srcWithVendoring \
"$UPDATE_NIX_ATTR_PATH" "$version"
fi
'';

mkDerivation = projectDscPath: attrsOrFun: stdenv.mkDerivation (finalAttrs:
let
Expand Down

0 comments on commit 655f80c

Please sign in to comment.