forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage.nix
More file actions
102 lines (92 loc) · 2.1 KB
/
package.nix
File metadata and controls
102 lines (92 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
{
lib,
stdenv,
fetchFromGitHub,
rustPlatform,
cargo,
pkg-config,
glibc,
openssl,
libepoxy,
libdrm,
pipewire,
virglrenderer,
libkrunfw,
rustc,
withBlk ? false,
withGpu ? false,
withSound ? false,
withNet ? false,
sevVariant ? false,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libkrun";
version = "1.11.2";
src = fetchFromGitHub {
owner = "containers";
repo = "libkrun";
tag = "v${finalAttrs.version}";
hash = "sha256-B11f7uG/oODwkME2rauCFbVysxUtUrUmd6RKeuBdnUU=";
};
outputs = [
"out"
"dev"
];
cargoDeps = rustPlatform.fetchCargoVendor {
inherit (finalAttrs) src;
hash = "sha256-bcHy8AfO9nzSZKoFlEpPKvwupt3eMb+A2rHDaUzO3/U=";
};
# Make sure libkrunfw can be found by dlopen()
# FIXME: This wasn't needed previously. What changed?
env.RUSTFLAGS = toString (
map (flag: "-C link-arg=" + flag) [
"-Wl,--push-state,--no-as-needed"
"-lkrunfw"
"-Wl,--pop-state"
]
);
nativeBuildInputs = [
rustPlatform.cargoSetupHook
rustPlatform.bindgenHook
cargo
rustc
] ++ lib.optional (sevVariant || withGpu) pkg-config;
buildInputs =
[
(libkrunfw.override { inherit sevVariant; })
glibc
glibc.static
]
++ lib.optionals withGpu [
libepoxy
libdrm
virglrenderer
]
++ lib.optional withSound pipewire
++ lib.optional sevVariant openssl;
makeFlags =
[
"PREFIX=${placeholder "out"}"
]
++ lib.optional withBlk "BLK=1"
++ lib.optional withGpu "GPU=1"
++ lib.optional withSound "SND=1"
++ lib.optional withNet "NET=1"
++ lib.optional sevVariant "SEV=1";
postInstall = ''
mkdir -p $dev/lib/pkgconfig
mv $out/lib64/pkgconfig $dev/lib/
mv $out/include $dev/
'';
meta = with lib; {
description = "Dynamic library providing Virtualization-based process isolation capabilities";
homepage = "https://github.com/containers/libkrun";
license = licenses.asl20;
maintainers = with maintainers; [
nickcao
RossComputerGuy
nrabulinski
];
platforms = libkrunfw.meta.platforms;
};
})