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

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

59 lines
1.8 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";
2022-11-30 12:17:47 +00:00
version = "3.8.1";
2022-08-13 09:42:36 +00:00
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}";
2022-11-30 12:17:47 +00:00
hash = "sha256-6jFIfTPjI6Eq0SFdQVxqqoBDW00AsDz/xHN+n6DezME=";
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";
2022-11-30 12:17:47 +00:00
hash = "sha256-i7btjGBgb93tHshIS02Rp492iB4aG0N4UuRwv6Pkukg=";
2022-08-13 09:42:36 +00:00
};
kernelSrc = fetchurl {
2022-11-30 12:17:47 +00:00
url = "https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.0.6.tar.xz";
hash = "sha256-hksFry2Gm6c9YanFlZ5FMaFBqyvXshdINnH2Jfl0f6o=";
2022-08-13 09:42:36 +00:00
};
preBuild = ''
2022-08-16 16:45:01 +00:00
substituteInPlace Makefile \
--replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)' \
2022-11-02 03:31:28 +00:00
--replace 'tar xf $(KERNEL_TARBALL)' \
'tar xf $(KERNEL_TARBALL); sed -i "s|/usr/bin/env bash|$(SHELL)|" $(KERNEL_SOURCES)/scripts/check-local-export' \
2022-08-16 16:45:01 +00:00
--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 ];
platforms = [ "x86_64-linux" "aarch64-darwin" ];
2022-08-13 09:42:36 +00:00
};
}