410b979fe2
GitOrigin-RevId: a64e169e396460d6b5763a1de1dd197df8421688
57 lines
1.7 KiB
Nix
57 lines
1.7 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, fetchurl
|
|
, flex
|
|
, bison
|
|
, bc
|
|
, elfutils
|
|
, python3
|
|
, sevVariant ? false
|
|
}:
|
|
|
|
assert sevVariant -> stdenv.isx86_64;
|
|
stdenv.mkDerivation rec {
|
|
pname = "libkrunfw";
|
|
version = "3.10.0";
|
|
|
|
src = if stdenv.isLinux then fetchFromGitHub {
|
|
owner = "containers";
|
|
repo = pname;
|
|
rev = "v${version}";
|
|
hash = "sha256-yL5D8oOGucLWi4kFPxan5Gq+jIkVSDOW/v1+zKg3G+o=";
|
|
} else fetchurl {
|
|
url = "https://github.com/containers/libkrunfw/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
|
|
hash = "sha256-Q7n+Og+eAnHSQm7kLUN0uV+CKcdtLBYAgt7Q0+CxEfA=";
|
|
};
|
|
|
|
kernelSrc = fetchurl {
|
|
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.2.1.tar.xz";
|
|
hash = "sha256-L8wH4ckOpM4Uj1D5vusNygtuSzeado3oq8ekom8lJTQ=";
|
|
};
|
|
|
|
preBuild = ''
|
|
substituteInPlace Makefile \
|
|
--replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)' \
|
|
--replace 'gcc' '$(CC)'
|
|
'';
|
|
|
|
nativeBuildInputs = [ flex bison bc python3 python3.pkgs.pyelftools ];
|
|
buildInputs = lib.optionals stdenv.isLinux [ elfutils ];
|
|
|
|
makeFlags = [
|
|
"PREFIX=${placeholder "out"}"
|
|
"SONAME_Darwin=-Wl,-install_name,${placeholder "out"}/lib/libkrunfw.dylib"
|
|
] ++ lib.optional sevVariant "SEV=1";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
meta = with lib; {
|
|
description = "A dynamic library bundling the guest payload consumed by libkrun";
|
|
homepage = "https://github.com/containers/libkrunfw";
|
|
license = with licenses; [ lgpl2Only lgpl21Only ];
|
|
maintainers = with maintainers; [ nickcao ];
|
|
platforms = [ "x86_64-linux" "aarch64-darwin" ];
|
|
sourceProvenance = with sourceTypes; lib.optionals stdenv.isDarwin [ binaryNativeCode ];
|
|
};
|
|
}
|