nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 libevent,
7 libtirpc,
8}:
9
10stdenv.mkDerivation {
11 pname = "trickle";
12 version = "1.07-unstable-2019-10-03";
13
14 src = fetchFromGitHub {
15 owner = "mariusae";
16 repo = "trickle";
17 rev = "09a1d955c6554eb7e625c99bf96b2d99ec7db3dc";
18 sha256 = "sha256-cqkNPeTo+noqMCXsxh6s4vKoYwsWusafm/QYX8RvCek=";
19 };
20
21 patches = [
22 ./trickle-gcc14.patch
23 ./atomicio.patch
24 ./remove-libtrickle.patch
25 ];
26
27 nativeBuildInputs = [
28 autoreconfHook
29 ];
30
31 buildInputs = [
32 libevent
33 libtirpc
34 ];
35
36 preAutoreconf = ''
37 sed -i -e 's|\s*LIBCGUESS=.*|LIBCGUESS=${stdenv.cc.libc}/lib/libc.so.*|' configure.in
38 grep LIBCGUESS configure.in
39 sed -i 's|libevent.a|libevent.so|' configure.in
40 '';
41
42 preBuild = ''
43 sed -i '/#define in_addr_t/ s:^://:' config.h
44 sed -i 's|^_select(int|select(int|' trickle-overload.c
45 '';
46
47 NIX_LDFLAGS = [
48 "-levent"
49 "-ltirpc"
50 ];
51 env.NIX_CFLAGS_COMPILE = toString [
52 "-I${libtirpc.dev}/include/tirpc"
53 "-Wno-error=incompatible-pointer-types"
54 ];
55
56 configureFlags = [ "--with-libevent" ];
57
58 hardeningDisable = [ "format" ];
59
60 meta = {
61 description = "Lightweight userspace bandwidth shaper";
62 license = lib.licenses.bsd3;
63 homepage = "https://monkey.org/~marius/pages/?page=trickle";
64 platforms = lib.platforms.linux;
65 mainProgram = "trickle";
66 };
67}