nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
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,
14}:
15
16stdenv.mkDerivation (finalAttrs: {
17 pname = "libkrunfw";
18 version = "4.9.0";
19
20 src = fetchFromGitHub {
21 owner = "containers";
22 repo = "libkrunfw";
23 tag = "v${finalAttrs.version}";
24 hash = "sha256-wmvjex68Mh7qehA33WNBYHhV9Q/XWLixokuGWnqJ3n0=";
25 };
26
27 kernelSrc = fetchurl {
28 url = "mirror://kernel/linux/kernel/v6.x/linux-6.12.20.tar.xz";
29 hash = "sha256-Iw6JsHsKuC508H7MG+4xBdyoHQ70qX+QCSnEBySbasc=";
30 };
31
32 postPatch = ''
33 substituteInPlace Makefile \
34 --replace 'curl $(KERNEL_REMOTE) -o $(KERNEL_TARBALL)' 'ln -s $(kernelSrc) $(KERNEL_TARBALL)'
35 '';
36
37 nativeBuildInputs = [
38 flex
39 bison
40 bc
41 cpio
42 perl
43 python3
44 python3.pkgs.pyelftools
45 ];
46
47 buildInputs = [
48 elfutils
49 ];
50
51 makeFlags = [
52 "PREFIX=${placeholder "out"}"
53 ]
54 ++ lib.optionals sevVariant [
55 "SEV=1"
56 ];
57
58 # Fixes https://github.com/containers/libkrunfw/issues/55
59 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.targetPlatform.isAarch64 "-march=armv8-a+crypto";
60
61 enableParallelBuilding = true;
62
63 meta = with lib; {
64 description = "Dynamic library bundling the guest payload consumed by libkrun";
65 homepage = "https://github.com/containers/libkrunfw";
66 license = with licenses; [
67 lgpl2Only
68 lgpl21Only
69 ];
70 maintainers = with maintainers; [
71 nickcao
72 RossComputerGuy
73 nrabulinski
74 ];
75 platforms = [ "x86_64-linux" ] ++ lib.optionals (!sevVariant) [ "aarch64-linux" ];
76 };
77})