nixpkgs/pkgs/development/libraries/libkrunfw/default.nix

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

57 lines
1.6 KiB
Nix
Raw Normal View History

2022-08-13 09:42:36 +00:00
{ lib
, stdenv
, fetchFromGitHub
, fetchurl
, flex
, bison
, bc
, elfutils
, python3
, sevVariant ? false
}:
assert sevVariant -> stdenv.isx86_64;
stdenv.mkDerivation rec {
pname = "libkrunfw";
version = "3.3.0";
2022-08-16 16:45:01 +00:00
src = if stdenv.isLinux then fetchFromGitHub {
2022-08-13 09:42:36 +00:00
owner = "containers";
repo = pname;
rev = "v${version}";
hash = "sha256-ay+E5AgJeA0i3T4JDosDawwtezDGquzAvYEWHGbPidg=";
2022-08-16 16:45:01 +00:00
} else fetchurl {
url = "https://github.com/containers/libkrunfw/releases/download/v${version}/v${version}-with_macos_prebuilts.tar.gz";
hash = "sha256-9Wp93PC+PEqUpWHIe6BUnfDMpFvYL8rGGjTU2nWSUVY=";
2022-08-13 09:42:36 +00:00
};
kernelSrc = fetchurl {
url = "https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.15.59.tar.xz";
hash = "sha256-5t3GQgVzQNsGs7khwrMb/tLGETWejxRMPlz5w6wzvMs=";
};
preBuild = ''
2022-08-16 16:45:01 +00:00
substituteInPlace Makefile \
--replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)' \
--replace 'gcc' '$(CC)'
2022-08-13 09:42:36 +00:00
'';
nativeBuildInputs = [ flex bison bc python3 python3.pkgs.pyelftools ];
2022-08-16 16:45:01 +00:00
buildInputs = lib.optionals stdenv.isLinux [ elfutils ];
2022-08-13 09:42:36 +00:00
2022-08-16 16:45:01 +00:00
makeFlags = [
"PREFIX=${placeholder "out"}"
"SONAME_Darwin=-Wl,-install_name,${placeholder "out"}/lib/libkrunfw.dylib"
] ++ lib.optional sevVariant "SEV=1";
2022-08-13 09:42:36 +00:00
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 ];
2022-08-16 16:45:01 +00:00
platforms = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
2022-08-13 09:42:36 +00:00
};
}