Use makeWrapper to wrap lanzatool

This commit is contained in:
Julian Stecklina 2022-11-24 12:05:46 +01:00
parent 7245142c55
commit 521bf343f5
1 changed files with 12 additions and 6 deletions

View File

@ -16,6 +16,8 @@
]; ];
}; };
lib = pkgs.lib;
rust-nightly = pkgs.rust-bin.fromRustupToolchainFile ./rust/lanzaboote/rust-toolchain.toml; rust-nightly = pkgs.rust-bin.fromRustupToolchainFile ./rust/lanzaboote/rust-toolchain.toml;
naersk-nightly = pkgs.callPackage naersk { naersk-nightly = pkgs.callPackage naersk {
@ -78,13 +80,17 @@
buildInputs = [ pkgs.binutils ]; buildInputs = [ pkgs.binutils ];
}; };
lanzatool = pkgs.writeShellScriptBin "lanzatool" '' lanzatool = pkgs.runCommand "lanzatool" {
set -euo pipefail nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
mkdir -p $out/bin
export LANZABOOTE_STUB=${lanzaboote}/bin/lanzaboote.efi # Clean PATH to only contain what we need to do objcopy. Also
export LANZABOOTE_INITRD_STUB=${initrd-stub}/bin/initrd-stub.efi # tell lanzatool where to find our UEFI binaries.
makeWrapper ${lanzatoolBin}/bin/lanzatool $out/bin/lanzatool \
${lanzatoolBin}/bin/lanzatool "$@" --set PATH ${lib.makeBinPath [ pkgs.binutils-unwrapped ]} \
--set LANZABOOTE_STUB ${lanzaboote}/bin/lanzaboote.efi \
--set LANZABOOTE_INITRD_STUB ${initrd-stub}/bin/initrd-stub.efi
''; '';
# A script that takes an initrd and turns it into a PE image. # A script that takes an initrd and turns it into a PE image.