Move uefi-run into its own Nix file

This commit is contained in:
Julian Stecklina 2022-11-22 00:42:41 +01:00
parent 6e13511b4d
commit bcad59a20a
2 changed files with 26 additions and 21 deletions

View File

@ -16,11 +16,12 @@
]; ];
}; };
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust/rust-toolchain.toml; rust-nightly = pkgs.rust-bin.fromRustupToolchainFile ./rust/rust-toolchain.toml;
naersk' = pkgs.callPackage naersk { naersk-stable = pkgs.callPackage naersk {};
cargo = rust; naersk-nightly = pkgs.callPackage naersk {
rustc = rust; cargo = rust-nightly;
rustc = rust-nightly;
}; };
qemuUefi = pkgs.writeShellScriptBin "qemu-uefi" '' qemuUefi = pkgs.writeShellScriptBin "qemu-uefi" ''
@ -29,21 +30,8 @@
-m 4096 -serial stdio "$@" -m 4096 -serial stdio "$@"
''; '';
uefi-run = naersk'.buildPackage { uefi-run = pkgs.callPackage ./nix/uefi-run.nix {
src = pkgs.fetchFromGitHub { naersk = naersk-stable;
owner = "Richard-W";
repo = "uefi-run";
rev = "8ba33c934525458a784a6620705bcf46c3ca91d2";
sha256 = "fwzWdOinW/ECVI/65pPB1shxPdl2nZThAqlg8wlWg/g=";
};
nativeBuildInputs = [ pkgs.makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/uefi-run" \
--add-flags '--bios-path ${pkgs.OVMF.fd}/FV/OVMF.fd --qemu-path ${pkgs.qemu}/bin/qemu-system-x86_64'
'';
}; };
systemd-boot-run = pkgs.writeShellScriptBin "systemd-boot-run" '' systemd-boot-run = pkgs.writeShellScriptBin "systemd-boot-run" ''
@ -69,7 +57,7 @@
"$IN" "$OUT" "$IN" "$OUT"
''; '';
lanzaboote = naersk'.buildPackage { lanzaboote = naersk-nightly.buildPackage {
src = ./rust; src = ./rust;
cargoBuildOptions = old: old ++ [ cargoBuildOptions = old: old ++ [
"--target x86_64-unknown-uefi" "--target x86_64-unknown-uefi"
@ -103,7 +91,7 @@
nativeBuildInputs = [ nativeBuildInputs = [
qemuUefi qemuUefi
uefi-run uefi-run
rust rust-nightly
pkgs.pev pkgs.pev
add-sections add-sections
]; ];

17
nix/uefi-run.nix Normal file
View File

@ -0,0 +1,17 @@
{ fetchFromGitHub, naersk, makeWrapper, OVMF, qemu }:
naersk.buildPackage {
src = fetchFromGitHub {
owner = "Richard-W";
repo = "uefi-run";
rev = "8ba33c934525458a784a6620705bcf46c3ca91d2";
sha256 = "fwzWdOinW/ECVI/65pPB1shxPdl2nZThAqlg8wlWg/g=";
};
nativeBuildInputs = [ makeWrapper ];
postInstall = ''
wrapProgram "$out/bin/uefi-run" \
--add-flags '--bios-path ${OVMF.fd}/FV/OVMF.fd --qemu-path ${qemu}/bin/qemu-system-x86_64'
'';
}