nixpkgs/pkgs/by-name/li/libkrunfw/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
1.5 KiB
Nix
Raw Normal View History

2022-08-13 09:42:36 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, flex
, bison
, bc
, cpio
, perl
2022-08-13 09:42:36 +00:00
, elfutils
, python3
, sevVariant ? false
}:
stdenv.mkDerivation (finalAttrs: {
2022-08-13 09:42:36 +00:00
pname = "libkrunfw";
version = "4.5.1";
2022-08-13 09:42:36 +00:00
src = fetchFromGitHub {
2022-08-13 09:42:36 +00:00
owner = "containers";
repo = "libkrunfw";
rev = "refs/tags/v${finalAttrs.version}";
hash = "sha256-GFfBiGMOyBwMKjpD1kj3vRpvjR0ydji3QNDyoOQoQsw=";
2022-08-13 09:42:36 +00:00
};
kernelSrc = fetchurl {
url = "mirror://kernel/linux/kernel/v6.x/linux-6.6.59.tar.xz";
hash = "sha256-I2FoCNjAjxKBX/iY9O20wROXorKEPQKe5iRS0hgzp20=";
2022-08-13 09:42:36 +00:00
};
postPatch = ''
2022-08-16 16:45:01 +00:00
substituteInPlace Makefile \
--replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)'
2022-08-13 09:42:36 +00:00
'';
nativeBuildInputs = [
flex
bison
bc
cpio
perl
python3
python3.pkgs.pyelftools
];
buildInputs = [
elfutils
];
2022-08-13 09:42:36 +00:00
2022-08-16 16:45:01 +00:00
makeFlags = [
"PREFIX=${placeholder "out"}"
] ++ lib.optionals sevVariant [
"SEV=1"
];
2022-08-13 09:42:36 +00:00
# Fixes https://github.com/containers/libkrunfw/issues/55
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.targetPlatform.isAarch64 "-march=armv8-a+crypto";
2022-08-13 09:42:36 +00:00
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" ];
2022-08-13 09:42:36 +00:00
};
})