about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2024-03-28 08:43:14 +0100
committerGitHub <noreply@github.com>2024-03-28 08:43:14 +0100
commit4635cbb9df4ff20bc70eaed0e09cb8db94e5e676 (patch)
treed2947f62d4df9a7c7363efddb2a9647195048ebf /pkgs/tools
parent6409be114edd93db24e950b846b7b2c602134c0d (diff)
parent19280a7ce470e2cfd2418d90939c48d204425384 (diff)
Merge pull request #287964 from linyinfeng/shim
shim-unsigned: build and install MOKManager and fallback
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/misc/shim/default.nix24
1 files changed, 13 insertions, 11 deletions
diff --git a/pkgs/tools/misc/shim/default.nix b/pkgs/tools/misc/shim/default.nix
index 0b8f6dbe5a9f6..e4220cf5cc8ec 100644
--- a/pkgs/tools/misc/shim/default.nix
+++ b/pkgs/tools/misc/shim/default.nix
@@ -6,9 +6,9 @@ let
   inherit (stdenv.hostPlatform) system;
   throwSystem = throw "Unsupported system: ${system}";
 
-  target = {
-    x86_64-linux = "shimx64.efi";
-    aarch64-linux = "shimaa64.efi";
+  archSuffix = {
+    x86_64-linux = "x64";
+    aarch64-linux = "aa64";
   }.${system} or throwSystem;
 in stdenv.mkDerivation rec {
   pname = "shim";
@@ -28,19 +28,21 @@ in stdenv.mkDerivation rec {
 
   makeFlags =
     lib.optional (vendorCertFile != null) "VENDOR_CERT_FILE=${vendorCertFile}"
-    ++ lib.optional (defaultLoader != null) "DEFAULT_LOADER=${defaultLoader}"
-    ++ [ target ];
+    ++ lib.optional (defaultLoader != null) "DEFAULT_LOADER=${defaultLoader}";
 
-  installPhase = ''
-    mkdir -p $out/share/shim
-    install -m 644 ${target} $out/share/shim/
-  '';
+  installTargets = ["install-as-data"];
+  installFlags = [
+    "DATATARGETDIR=$(out)/share/shim"
+  ];
 
   passthru = {
-    # Expose the target file name so that consumers
+    # Expose the arch suffix and target file names so that consumers
     # (e.g. infrastructure for signing this shim) don't need to
     # duplicate the logic from here
-    inherit target;
+    inherit archSuffix;
+    target = "shim${archSuffix}.efi";
+    mokManagerTarget = "mm${archSuffix}.efi";
+    fallbackTarget = "fb${archSuffix}.efi";
   };
 
   meta = with lib; {