1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 autoreconfHook,
6 pkg-config,
7 varnish,
8 docutils,
9 removeReferencesTo,
10}:
11let
12 common =
13 {
14 version,
15 hash,
16 extraNativeBuildInputs ? [ ],
17 }:
18 stdenv.mkDerivation rec {
19 pname = "${varnish.name}-modules";
20 inherit version;
21
22 src = fetchFromGitHub {
23 owner = "varnish";
24 repo = "varnish-modules";
25 rev = version;
26 inherit hash;
27 };
28
29 nativeBuildInputs = [
30 autoreconfHook
31 docutils
32 pkg-config
33 removeReferencesTo
34 varnish.python # use same python version as varnish server
35 ];
36
37 buildInputs = [ varnish ];
38
39 postPatch = ''
40 substituteInPlace bootstrap --replace "''${dataroot}/aclocal" "${varnish.dev}/share/aclocal"
41 substituteInPlace Makefile.am --replace "''${LIBVARNISHAPI_DATAROOTDIR}/aclocal" "${varnish.dev}/share/aclocal"
42 '';
43
44 postInstall = "find $out -type f -exec remove-references-to -t ${varnish.dev} '{}' +"; # varnish.dev captured only as __FILE__ in assert messages
45
46 meta = with lib; {
47 description = "Collection of Varnish Cache modules (vmods) by Varnish Software";
48 homepage = "https://github.com/varnish/varnish-modules";
49 inherit (varnish.meta) license platforms teams;
50 };
51 };
52in
53{
54 modules15 = common {
55 version = "0.15.1";
56 hash = "sha256-Et/iWOk2FWJBDOpKjNXm4Nh5i1SU4zVPaID7kh+Uj9M=";
57 };
58 modules26 = common {
59 version = "0.26.0";
60 hash = "sha256-xKMOkqm6/GoBve0AhPqyVMQv/oh5Rtj6uCeg/yId7BU=";
61 };
62}