diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2023-03-10 22:36:47 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2023-03-10 22:36:47 +0100 |
commit | 5d45ddbfaa44d29eb6077153248806d73ceabde9 (patch) | |
tree | f6563406cdd540062a0ece5c4c540d0a9cf5572f /overlays/preserve-dscp/default.nix | |
parent | c2fbcde4449ffaf798f9ba4f742b942d33a1c1c8 (diff) | |
download | nixos-5d45ddbfaa44d29eb6077153248806d73ceabde9.tar nixos-5d45ddbfaa44d29eb6077153248806d73ceabde9.tar.gz nixos-5d45ddbfaa44d29eb6077153248806d73ceabde9.tar.bz2 nixos-5d45ddbfaa44d29eb6077153248806d73ceabde9.tar.xz nixos-5d45ddbfaa44d29eb6077153248806d73ceabde9.zip |
surtr: bifrost dscp
Diffstat (limited to 'overlays/preserve-dscp/default.nix')
-rw-r--r-- | overlays/preserve-dscp/default.nix | 36 |
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 | } | ||