1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 git,
6 gperf,
7 pcre,
8 unbound,
9 libev,
10 tokyocabinet,
11 pkg-config,
12 bash,
13 libsrs2,
14}:
15
16let
17 version = "0.9";
18
19 pfixtoolsSrc = fetchFromGitHub {
20 owner = "Fruneau";
21 repo = "pfixtools";
22 rev = "pfixtools-${version}";
23 sha256 = "1vmbrw686f41n6xfjphfshn96vl07ynvnsyjdw9yfn9bfnldcjcq";
24 };
25
26 srcRoot = pfixtoolsSrc.name;
27
28 libCommonSrc = fetchFromGitHub {
29 owner = "Fruneau";
30 repo = "libcommon";
31 rev = "b07e6bdea3d24748e0d39783d7d817096d10cc67";
32 sha256 = "14fxldp29j4vmfmhfgwwi37pj8cz0flm1aykkxlbgakz92d4pm35";
33 };
34
35in
36
37stdenv.mkDerivation {
38 pname = "pfixtools";
39 inherit version;
40
41 src = pfixtoolsSrc;
42
43 patches = [ ./0001-Fix-build-with-unbound-1.6.1.patch ];
44
45 nativeBuildInputs = [ pkg-config ];
46 buildInputs = [
47 git
48 gperf
49 pcre
50 unbound
51 libev
52 tokyocabinet
53 bash
54 libsrs2
55 ];
56
57 postUnpack = ''
58 cp -Rp ${libCommonSrc}/* ${srcRoot}/common;
59 chmod -R +w ${srcRoot}/common;
60 '';
61
62 postPatch = ''
63 substituteInPlace postlicyd/policy_tokens.sh \
64 --replace /bin/bash ${bash}/bin/bash;
65
66 substituteInPlace postlicyd/*_tokens.sh \
67 --replace "unsigned int" "size_t"
68 '';
69
70 env.NIX_CFLAGS_COMPILE = "-Wno-error=unused-result -Wno-error=nonnull-compare -Wno-error=format-truncation";
71
72 makeFlags = [
73 "DESTDIR=$(out)"
74 "prefix="
75 ];
76
77 meta = {
78 description = "Collection of postfix-related tools";
79 license = with lib.licenses; [ bsd3 ];
80 homepage = "https://github.com/Fruneau/pfixtools";
81 platforms = lib.platforms.linux;
82 maintainers = with lib.maintainers; [ jerith666 ];
83 };
84}