From 5d45ddbfaa44d29eb6077153248806d73ceabde9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 10 Mar 2023 22:36:47 +0100 Subject: surtr: bifrost dscp --- overlays/preserve-dscp/default.nix | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 overlays/preserve-dscp/default.nix (limited to 'overlays/preserve-dscp/default.nix') 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 @@ +{ final, prev, sources, ... }: +{ + preserve-dscp = prev.stdenv.mkDerivation rec { + pname = "preserve-dscp"; + inherit (sources.bpf-examples) version src; + + patches = [ ./kern_env.patch ./kern_sec_classifier.patch ]; + + makeFlags = [ "PREFIX=$(out)" ]; + buildFlags = [ "preserve-dscp" ]; + + CPATH = prev.lib.makeSearchPathOutput "dev" "include" (buildInputs ++ nativeBuildInputs); + BPF_CFLAGS = "-Wno-unused-command-line-argument -fno-stack-protector"; + + outputs = [ "out" "lib" ]; + + buildInputs = with final; [ elfutils libpcap zlib ]; + nativeBuildInputs = with final; [ llvmPackages.clang llvmPackages.llvm pkgconfig bpftool 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"; + }; +} -- cgit v1.2.3