2023-01-20 10:41:00 +00:00
|
|
|
{ stdenv, fetchFromGitHub, lib, elfutils, vendorCertFile ? null
|
|
|
|
, defaultLoader ? null }:
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
inherit (stdenv.hostPlatform) system;
|
2023-01-20 10:41:00 +00:00
|
|
|
throwSystem = throw "Unsupported system: ${system}";
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
archSuffix = {
|
|
|
|
x86_64-linux = "x64";
|
|
|
|
aarch64-linux = "aa64";
|
2023-01-20 10:41:00 +00:00
|
|
|
}.${system} or throwSystem;
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "shim";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "15.8";
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rhboot";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-xnr9HBfYP035C7p2YTRZasx5SF4a2ZkOl9IpsVduNm4=";
|
2023-01-20 10:41:00 +00:00
|
|
|
fetchSubmodules = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ elfutils ];
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-I${toString elfutils.dev}/include" ];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
makeFlags =
|
|
|
|
lib.optional (vendorCertFile != null) "VENDOR_CERT_FILE=${vendorCertFile}"
|
2024-04-21 15:54:59 +00:00
|
|
|
++ lib.optional (defaultLoader != null) "DEFAULT_LOADER=${defaultLoader}";
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
installTargets = ["install-as-data"];
|
|
|
|
installFlags = [
|
|
|
|
"DATATARGETDIR=$(out)/share/shim"
|
|
|
|
];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
passthru = {
|
2024-04-21 15:54:59 +00:00
|
|
|
# Expose the arch suffix and target file names so that consumers
|
2023-10-09 19:29:22 +00:00
|
|
|
# (e.g. infrastructure for signing this shim) don't need to
|
|
|
|
# duplicate the logic from here
|
2024-04-21 15:54:59 +00:00
|
|
|
inherit archSuffix;
|
|
|
|
target = "shim${archSuffix}.efi";
|
|
|
|
mokManagerTarget = "mm${archSuffix}.efi";
|
|
|
|
fallbackTarget = "fb${archSuffix}.efi";
|
2023-10-09 19:29:22 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "UEFI shim loader";
|
|
|
|
homepage = "https://github.com/rhboot/shim";
|
|
|
|
license = licenses.bsd1;
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
|
|
|
maintainers = with maintainers; [ baloo raitobezarius ];
|
|
|
|
};
|
|
|
|
}
|