depot/third_party/nixpkgs/pkgs/development/libraries/libkrunfw/default.nix
Default email 472aeafc57 Project import generated by Copybara.
GitOrigin-RevId: c31898adf5a8ed202ce5bea9f347b1c6871f32d1
2024-10-04 18:56:33 +02:00

68 lines
1.5 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, flex
, bison
, bc
, cpio
, perl
, elfutils
, python3
, sevVariant ? false
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libkrunfw";
version = "4.4.1";
src = fetchFromGitHub {
owner = "containers";
repo = "libkrunfw";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-rxMklV/pu/muz/7m1clEs+BItXid/jMt6j/R/yHBKHI=";
};
kernelSrc = fetchurl {
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.52.tar.xz";
hash = "sha256-FZGrNIOZ1KpTEhFYUlBWppyM8P4OkJNbAJXppY43tLg=";
};
postPatch = ''
substituteInPlace Makefile \
--replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)'
'';
nativeBuildInputs = [
flex
bison
bc
cpio
perl
python3
python3.pkgs.pyelftools
];
buildInputs = [
elfutils
];
makeFlags = [
"PREFIX=${placeholder "out"}"
] ++ lib.optionals sevVariant [
"SEV=1"
];
# Fixes https://github.com/containers/libkrunfw/issues/55
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.targetPlatform.isAarch64 "-march=armv8-a+crypto";
enableParallelBuilding = true;
meta = with lib; {
description = "Dynamic library bundling the guest payload consumed by libkrun";
homepage = "https://github.com/containers/libkrunfw";
license = with licenses; [ lgpl2Only lgpl21Only ];
maintainers = with maintainers; [ nickcao RossComputerGuy ];
platforms = [ "x86_64-linux" ] ++ lib.optionals (!sevVariant) [ "aarch64-linux" ];
};
})