summaryrefslogtreecommitdiff
path: root/overlays/preserve-dscp/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'overlays/preserve-dscp/default.nix')
-rw-r--r--overlays/preserve-dscp/default.nix36
1 files changed, 36 insertions, 0 deletions
diff --git a/overlays/preserve-dscp/default.nix b/overlays/preserve-dscp/default.nix
new file mode 100644
index 00000000..7f956a12
--- /dev/null
+++ b/overlays/preserve-dscp/default.nix
@@ -0,0 +1,36 @@
1{ final, prev, sources, ... }:
2{
3 preserve-dscp = prev.stdenv.mkDerivation rec {
4 pname = "preserve-dscp";
5 inherit (sources.bpf-examples) version src;
6
7 patches = [ ./kern_env.patch ./kern_sec_classifier.patch ];
8
9 makeFlags = [ "PREFIX=$(out)" ];
10 buildFlags = [ "preserve-dscp" ];
11
12 CPATH = prev.lib.makeSearchPathOutput "dev" "include" (buildInputs ++ nativeBuildInputs);
13 BPF_CFLAGS = "-Wno-unused-command-line-argument -fno-stack-protector";
14
15 outputs = [ "out" "lib" ];
16
17 buildInputs = with final; [ elfutils libpcap zlib ];
18 nativeBuildInputs = with final; [ llvmPackages.clang llvmPackages.llvm pkgconfig bpftool libmnl gnum4 glibc_multi makeWrapper ];
19
20 installPhase = ''
21 mkdir -p $lib/lib/bpf
22 install -t $lib/lib/bpf \
23 preserve-dscp/preserve_dscp_kern.o
24
25 mkdir -p $out/bin
26 install -m 555 -t $out/bin \
27 preserve-dscp/preserve-dscp
28 wrapProgram $out/bin/preserve-dscp \
29 --set-default PRESERVE_DSCP_KERN $lib/lib/bpf/preserve_dscp_kern.o
30 '';
31
32 dontFixup = true;
33
34 meta.mainProgram = "preserve-dscp";
35 };
36}