2022-08-21 13:32:41 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, flex
|
|
|
|
, bison
|
|
|
|
, bc
|
2024-07-27 06:49:29 +00:00
|
|
|
, cpio
|
|
|
|
, perl
|
2022-08-21 13:32:41 +00:00
|
|
|
, elfutils
|
|
|
|
, python3
|
|
|
|
, sevVariant ? false
|
|
|
|
}:
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-08-21 13:32:41 +00:00
|
|
|
pname = "libkrunfw";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "4.2.0";
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
src = fetchFromGitHub {
|
2022-08-21 13:32:41 +00:00
|
|
|
owner = "containers";
|
2024-01-02 11:29:13 +00:00
|
|
|
repo = "libkrunfw";
|
2024-07-27 06:49:29 +00:00
|
|
|
rev = "refs/tags/v${finalAttrs.version}";
|
|
|
|
hash = "sha256-LaIyPk9QkxPFP169r6PqyBMpFujbQBlX77z63OqKGYc=";
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
kernelSrc = fetchurl {
|
2024-07-27 06:49:29 +00:00
|
|
|
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.32.tar.xz";
|
|
|
|
hash = "sha256-qqgk6vB/YZEdIrdf8JCkA8PdC9c+I5M+C7qLWXFDbOE=";
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
postPatch = ''
|
2022-09-14 18:05:37 +00:00
|
|
|
substituteInPlace Makefile \
|
2024-01-02 11:29:13 +00:00
|
|
|
--replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)'
|
2022-08-21 13:32:41 +00:00
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
flex
|
|
|
|
bison
|
|
|
|
bc
|
2024-07-27 06:49:29 +00:00
|
|
|
cpio
|
|
|
|
perl
|
2024-01-02 11:29:13 +00:00
|
|
|
python3
|
|
|
|
python3.pkgs.pyelftools
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
elfutils
|
|
|
|
];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2022-09-14 18:05:37 +00:00
|
|
|
makeFlags = [
|
|
|
|
"PREFIX=${placeholder "out"}"
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ lib.optionals sevVariant [
|
|
|
|
"SEV=1"
|
|
|
|
];
|
2022-08-21 13:32:41 +00:00
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
# Fixes https://github.com/containers/libkrunfw/issues/55
|
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.targetPlatform.isAarch64 "-march=armv8-a+crypto";
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Dynamic library bundling the guest payload consumed by libkrun";
|
2022-08-21 13:32:41 +00:00
|
|
|
homepage = "https://github.com/containers/libkrunfw";
|
|
|
|
license = with licenses; [ lgpl2Only lgpl21Only ];
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = with maintainers; [ nickcao RossComputerGuy ];
|
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2022-08-21 13:32:41 +00:00
|
|
|
};
|
2024-07-27 06:49:29 +00:00
|
|
|
})
|