nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 cmake,
3 fetchFromGitHub,
4 fetchpatch,
5 json_c,
6 libpcap,
7 ncurses,
8 lib,
9 stdenv,
10 libtirpc,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "nfstrace";
15 version = "0.4.3.2";
16
17 src = fetchFromGitHub {
18 owner = "epam";
19 repo = "nfstrace";
20 rev = version;
21 sha256 = "1djsyn7i3xp969rnmsdaf5vwjiik9wylxxrc5nm7by00i76c1vsg";
22 };
23
24 patches = [
25 (fetchpatch {
26 url = "https://salsa.debian.org/debian/nfstrace/raw/debian/0.4.3.1-3/debian/patches/reproducible_build.patch";
27 sha256 = "0fd96r8xi142kjwibqkd46s6jwsg5kfc5v28bqsj9rdlc2aqmay5";
28 })
29 # Fixes build failure with gcc-10
30 # Related PR https://github.com/epam/nfstrace/pull/42/commits/4562a895ed3ac0e811bdd489068ad3ebe4d7b501
31 (fetchpatch {
32 url = "https://github.com/epam/nfstrace/commit/4562a895ed3ac0e811bdd489068ad3ebe4d7b501.patch";
33 sha256 = "1fbicbllyykjknik7asa81x0ixxmbwqwkiz74cnznagv10jlkj3p";
34 })
35
36 # Fix pending upstream inclusion for ncurses-6.3 support:
37 # https://github.com/epam/nfstrace/pull/50
38 (fetchpatch {
39 name = "ncurses-6.3.patch";
40 url = "https://github.com/epam/nfstrace/commit/29c7c415f5412df1aae9b1e6ed3a2760d2c227a0.patch";
41 sha256 = "134709w6bld010jx3xdy9imcjzal904a84n9f8vv0wnas5clxdmx";
42 })
43 ];
44
45 postPatch = ''
46 # -Wall -Wextra -Werror fails on clang and newer gcc
47 substituteInPlace CMakeLists.txt \
48 --replace "-Wno-braced-scalar-init" "" \
49 --replace "-Werror" ""
50 '';
51
52 buildInputs = [
53 json_c
54 libpcap
55 ncurses
56 libtirpc
57 ];
58 nativeBuildInputs = [ cmake ];
59
60 # To build with GCC 8+ it needs:
61 CXXFLAGS = "-Wno-class-memaccess -Wno-ignored-qualifiers";
62 # CMake can't find json_c without:
63 env.NIX_CFLAGS_COMPILE = toString [
64 "-I${json_c.dev}/include/json-c"
65 "-Wno-error=address-of-packed-member"
66 "-I${libtirpc.dev}/include/tirpc"
67 ];
68 NIX_LDFLAGS = [ "-ltirpc" ];
69
70 doCheck = false; # requires network access
71
72 meta = with lib; {
73 homepage = "http://epam.github.io/nfstrace/";
74 description = "NFS and CIFS tracing/monitoring/capturing/analyzing tool";
75 license = licenses.gpl2Only;
76 platforms = platforms.linux;
77 mainProgram = "nfstrace";
78 };
79}