13 assert sevVariant -> stdenv.isx86_64;
14 stdenv.mkDerivation rec {
18 src = if stdenv.isLinux then fetchFromGitHub {
22 hash = "sha256-p5z3Dc7o/Ja3K0VlOWIPc0qOIU5p+JSxWe7QiVQNkjs=";
24 url = "https://github.com/containers/libkrunfw/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
25 hash = "sha256-XcdsK8L5NwMgelSMhE2YKYxaAin/3p/+GrljGGZpK5Y=";
28 kernelSrc = fetchurl {
29 url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.2.9.tar.xz";
30 hash = "sha256-kDRJwWTAPw50KqzJIOGFY1heB6KMbLeeD9bDZpX9Q/U=";
34 substituteInPlace Makefile \
35 --replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)' \
36 --replace 'gcc' '$(CC)'
39 nativeBuildInputs = [ flex bison bc python3 python3.pkgs.pyelftools ];
40 buildInputs = lib.optionals stdenv.isLinux [ elfutils ];
43 "PREFIX=${placeholder "out"}"
44 "SONAME_Darwin=-Wl,-install_name,${placeholder "out"}/lib/libkrunfw.dylib"
45 ] ++ lib.optional sevVariant "SEV=1";
47 enableParallelBuilding = true;
50 description = "A dynamic library bundling the guest payload consumed by libkrun";
51 homepage = "https://github.com/containers/libkrunfw";
52 license = with licenses; [ lgpl2Only lgpl21Only ];
53 maintainers = with maintainers; [ nickcao ];
54 platforms = [ "x86_64-linux" "aarch64-darwin" ];
55 sourceProvenance = with sourceTypes; lib.optionals stdenv.isDarwin [ binaryNativeCode ];