1 { stdenv, fetchFromGitHub, lib, elfutils, vendorCertFile ? null
2 , defaultLoader ? null }:
6 inherit (stdenv.hostPlatform) system;
7 throwSystem = throw "Unsupported system: ${system}";
11 aarch64-linux = "aa64";
12 }.${system} or throwSystem;
13 in stdenv.mkDerivation rec {
17 src = fetchFromGitHub {
21 hash = "sha256-xnr9HBfYP035C7p2YTRZasx5SF4a2ZkOl9IpsVduNm4=";
22 fetchSubmodules = true;
25 buildInputs = [ elfutils ];
27 env.NIX_CFLAGS_COMPILE = toString [ "-I${toString elfutils.dev}/include" ];
30 lib.optional (vendorCertFile != null) "VENDOR_CERT_FILE=${vendorCertFile}"
31 ++ lib.optional (defaultLoader != null) "DEFAULT_LOADER=${defaultLoader}";
33 installTargets = ["install-as-data"];
35 "DATATARGETDIR=$(out)/share/shim"
39 # Expose the arch suffix and target file names so that consumers
40 # (e.g. infrastructure for signing this shim) don't need to
41 # duplicate the logic from here
43 target = "shim${archSuffix}.efi";
44 mokManagerTarget = "mm${archSuffix}.efi";
45 fallbackTarget = "fb${archSuffix}.efi";
49 description = "UEFI shim loader";
50 homepage = "https://github.com/rhboot/shim";
51 license = licenses.bsd1;
52 platforms = [ "x86_64-linux" "aarch64-linux" ];
53 maintainers = with maintainers; [ baloo raitobezarius ];