blob: 105eccb924a54f3989cc91b203596e3266874632 (
plain)
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
|
{ final, prev, sources, ... }:
{
preserve-dscp = prev.stdenv.mkDerivation rec {
pname = "preserve-dscp";
inherit (sources.bpf-examples) version src;
patches = [ ./kern_env.patch ];
makeFlags = [ "PREFIX=$(out)" ];
buildFlags = [ "preserve-dscp" ];
CPATH = prev.lib.makeSearchPathOutput "dev" "include" (buildInputs ++ nativeBuildInputs);
BPF_CFLAGS = "-Wno-unused-command-line-argument";
hardeningDisable = [ "stackprotector" "zerocallusedregs" ];
outputs = [ "out" "lib" ];
buildInputs = with final; [ elfutils libpcap zlib ];
nativeBuildInputs = with final; [ llvmPackages.clang llvmPackages.llvm pkg-config bpftools libmnl gnum4 glibc_multi makeWrapper ];
installPhase = ''
mkdir -p $lib/lib/bpf
install -t $lib/lib/bpf \
preserve-dscp/preserve_dscp_kern.o
mkdir -p $out/bin
install -m 555 -t $out/bin \
preserve-dscp/preserve-dscp
wrapProgram $out/bin/preserve-dscp \
--set-default PRESERVE_DSCP_KERN $lib/lib/bpf/preserve_dscp_kern.o
'';
dontFixup = true;
meta.mainProgram = "preserve-dscp";
};
}
|