From 7caeaaf40d4e0ccf6ae117db21d7d0e42f4d9e30 Mon Sep 17 00:00:00 2001 From: tirex Date: Sun, 7 Aug 2022 15:58:51 +0200 Subject: [PATCH 1/4] maintainers: add tirex --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 8eac070f26c1..0cb901b4912a 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -13010,6 +13010,12 @@ githubId = 1292007; name = "Sébastien Maccagnoni"; }; + tirex = { + email = "szymon@kliniewski.pl"; + name = "Szymon Kliniewski"; + github = "NoneTirex"; + githubId = 26038207; + }; titanous = { email = "jonathan@titanous.com"; github = "titanous"; From 6f19e6eb5469ab077c69fc28e5f4d43e3265c324 Mon Sep 17 00:00:00 2001 From: tirex Date: Sun, 7 Aug 2022 16:18:27 +0200 Subject: [PATCH 2/4] xdp-tools: init at 1.2.5 --- pkgs/tools/networking/xdp-tools/default.nix | 67 +++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 69 insertions(+) create mode 100644 pkgs/tools/networking/xdp-tools/default.nix diff --git a/pkgs/tools/networking/xdp-tools/default.nix b/pkgs/tools/networking/xdp-tools/default.nix new file mode 100644 index 000000000000..c388b3019e30 --- /dev/null +++ b/pkgs/tools/networking/xdp-tools/default.nix @@ -0,0 +1,67 @@ +{ lib +, stdenv +, fetchFromGitHub +, libbpf +, elfutils +, libelf +, zlib +, libpcap +, clang +, llvm +, gnumake +, gcc +, pkgconfig +, m4 +, emacs-nox +, wireshark-cli +}: +stdenv.mkDerivation rec { + pname = "xdp-tools"; + version = "1.2.5"; + + src = fetchFromGitHub { + owner = "xdp-project"; + repo = "xdp-tools"; + rev = "v${version}"; + sha256 = "sha256-Kyay5j+87nOZ9C+DI8MI6zhkWqspIHiTfW9Di5uVWzY="; + }; + + buildInputs = [ + libbpf + elfutils + libelf + libpcap + zlib + ]; + + nativeBuildInputs = [ + clang + llvm + gnumake + gcc + pkgconfig + m4 + emacs-nox + wireshark-cli + ]; + + BPF_CFLAGS = "-fno-stack-protector -Wno-error=unused-command-line-argument"; + PRODUCTION = 1; + DYNAMIC_LIBXDP = 1; + FORCE_SYSTEM_LIBBPF = 1; + FORCE_EMACS = 1; + + installPhase = '' + export PREFIX=$out + + make install + ''; + + meta = with lib; { + homepage = "https://github.com/xdp-project/xdp-tools"; + description = "Library and utilities for use with XDP"; + license = with licenses; [ gpl2 lgpl21 bsd2 ]; + maintainers = with maintainers; [ tirex ]; + platforms = platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b942c9368456..1e4de5d69fc1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11987,6 +11987,8 @@ with pkgs; xdg-launch = callPackage ../applications/misc/xdg-launch { }; + xdp-tools = callPackage ../tools/networking/xdp-tools { }; + xkbvalidate = callPackage ../tools/X11/xkbvalidate { }; xkeysnail = callPackage ../tools/X11/xkeysnail { }; From 67902931f49b3262f3a5de4627779a6b14c2a812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 4 Sep 2022 20:15:57 +0200 Subject: [PATCH 3/4] xdp-tools: 1.2.5 -> 1.2.6 --- pkgs/tools/networking/xdp-tools/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/networking/xdp-tools/default.nix b/pkgs/tools/networking/xdp-tools/default.nix index c388b3019e30..188b28f63b52 100644 --- a/pkgs/tools/networking/xdp-tools/default.nix +++ b/pkgs/tools/networking/xdp-tools/default.nix @@ -17,13 +17,13 @@ }: stdenv.mkDerivation rec { pname = "xdp-tools"; - version = "1.2.5"; + version = "1.2.6"; src = fetchFromGitHub { owner = "xdp-project"; repo = "xdp-tools"; rev = "v${version}"; - sha256 = "sha256-Kyay5j+87nOZ9C+DI8MI6zhkWqspIHiTfW9Di5uVWzY="; + sha256 = "xKxR20Jz+pGKzazFoZe0i0pv7AuaxdL8Yt3IE4JAje8="; }; buildInputs = [ From 797d7c7b9e66698d9f0cd188be92733cda7b4b17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Sun, 4 Sep 2022 20:20:33 +0200 Subject: [PATCH 4/4] xdp-tools: various improvements --- pkgs/tools/networking/xdp-tools/default.nix | 49 +++++++++++++-------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/pkgs/tools/networking/xdp-tools/default.nix b/pkgs/tools/networking/xdp-tools/default.nix index 188b28f63b52..4861347e38fe 100644 --- a/pkgs/tools/networking/xdp-tools/default.nix +++ b/pkgs/tools/networking/xdp-tools/default.nix @@ -1,19 +1,17 @@ { lib , stdenv , fetchFromGitHub +, fetchpatch , libbpf , elfutils -, libelf , zlib , libpcap -, clang -, llvm -, gnumake -, gcc -, pkgconfig +, llvmPackages +, pkg-config , m4 , emacs-nox , wireshark-cli +, nukeReferences }: stdenv.mkDerivation rec { pname = "xdp-tools"; @@ -26,42 +24,57 @@ stdenv.mkDerivation rec { sha256 = "xKxR20Jz+pGKzazFoZe0i0pv7AuaxdL8Yt3IE4JAje8="; }; + outputs = [ "out" "lib" ]; + + patches = [ + (fetchpatch { + # Compat with libbpf 1.0: https://github.com/xdp-project/xdp-tools/pull/221 + url = "https://github.com/xdp-project/xdp-tools/commit/f8592d0609807f5b2b73d27eb3bd623da4bd1997.diff"; + sha256 = "+NpR0d5YE1TMFeyidBuXCDkcBTa2W0094nqYiEWKpY4="; + }) + ]; + buildInputs = [ libbpf elfutils - libelf libpcap zlib ]; nativeBuildInputs = [ - clang - llvm - gnumake - gcc - pkgconfig + llvmPackages.clang + llvmPackages.llvm + pkg-config m4 - emacs-nox - wireshark-cli + emacs-nox # to generate man pages from .org + nukeReferences + ]; + checkInputs = [ + wireshark-cli # for tshark ]; + # When building BPF, the default CC wrapper is interfering a bit too much. BPF_CFLAGS = "-fno-stack-protector -Wno-error=unused-command-line-argument"; + PRODUCTION = 1; DYNAMIC_LIBXDP = 1; FORCE_SYSTEM_LIBBPF = 1; FORCE_EMACS = 1; - installPhase = '' - export PREFIX=$out + makeFlags = [ "PREFIX=$(out)" "LIBDIR=$(lib)/lib" ]; - make install + postInstall = '' + # Note that even the static libxdp would refer to BPF_OBJECT_DIR ?=$(LIBDIR)/bpf + rm "$lib"/lib/*.a + # Drop unfortunate references to glibc.dev/include at least from $lib + nuke-refs "$lib"/lib/bpf/*.o ''; meta = with lib; { homepage = "https://github.com/xdp-project/xdp-tools"; description = "Library and utilities for use with XDP"; license = with licenses; [ gpl2 lgpl21 bsd2 ]; - maintainers = with maintainers; [ tirex ]; + maintainers = with maintainers; [ tirex vcunat ]; platforms = platforms.linux; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1e4de5d69fc1..f908f12d105c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11987,7 +11987,9 @@ with pkgs; xdg-launch = callPackage ../applications/misc/xdg-launch { }; - xdp-tools = callPackage ../tools/networking/xdp-tools { }; + xdp-tools = callPackage ../tools/networking/xdp-tools { + llvmPackages = llvmPackages_14; + }; xkbvalidate = callPackage ../tools/X11/xkbvalidate { };