openxray: 2188-november-2023-rc1 -> 2921-january-2025-rc1 (#375925)
[NixPkgs.git] / pkgs / by-name / li / libkrunfw / package.nix
blob5a70ea441b9169d17e79c32daf0876b3b316b669
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   fetchurl,
6   flex,
7   bison,
8   bc,
9   cpio,
10   perl,
11   elfutils,
12   python3,
13   sevVariant ? false,
16 stdenv.mkDerivation (finalAttrs: {
17   pname = "libkrunfw";
18   version = "4.5.1";
20   src = fetchFromGitHub {
21     owner = "containers";
22     repo = "libkrunfw";
23     tag = "v${finalAttrs.version}";
24     hash = "sha256-GFfBiGMOyBwMKjpD1kj3vRpvjR0ydji3QNDyoOQoQsw=";
25   };
27   kernelSrc = fetchurl {
28     url = "mirror://kernel/linux/kernel/v6.x/linux-6.6.59.tar.xz";
29     hash = "sha256-I2FoCNjAjxKBX/iY9O20wROXorKEPQKe5iRS0hgzp20=";
30   };
32   postPatch = ''
33     substituteInPlace Makefile \
34       --replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)'
35   '';
37   nativeBuildInputs = [
38     flex
39     bison
40     bc
41     cpio
42     perl
43     python3
44     python3.pkgs.pyelftools
45   ];
47   buildInputs = [
48     elfutils
49   ];
51   makeFlags =
52     [
53       "PREFIX=${placeholder "out"}"
54     ]
55     ++ lib.optionals sevVariant [
56       "SEV=1"
57     ];
59   # Fixes https://github.com/containers/libkrunfw/issues/55
60   NIX_CFLAGS_COMPILE = lib.optionalString stdenv.targetPlatform.isAarch64 "-march=armv8-a+crypto";
62   enableParallelBuilding = true;
64   meta = with lib; {
65     description = "Dynamic library bundling the guest payload consumed by libkrun";
66     homepage = "https://github.com/containers/libkrunfw";
67     license = with licenses; [
68       lgpl2Only
69       lgpl21Only
70     ];
71     maintainers = with maintainers; [
72       nickcao
73       RossComputerGuy
74     ];
75     platforms = [ "x86_64-linux" ] ++ lib.optionals (!sevVariant) [ "aarch64-linux" ];
76   };