about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/varnish
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/varnish')
-rw-r--r--nixpkgs/pkgs/servers/varnish/default.nix54
-rw-r--r--nixpkgs/pkgs/servers/varnish/digest.nix31
-rw-r--r--nixpkgs/pkgs/servers/varnish/dynamic.nix26
-rw-r--r--nixpkgs/pkgs/servers/varnish/geoip.nix31
-rw-r--r--nixpkgs/pkgs/servers/varnish/modules.nix29
-rw-r--r--nixpkgs/pkgs/servers/varnish/packages.nix22
-rw-r--r--nixpkgs/pkgs/servers/varnish/rtstatus.nix21
7 files changed, 214 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/varnish/default.nix b/nixpkgs/pkgs/servers/varnish/default.nix
new file mode 100644
index 000000000000..e447035e32aa
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/default.nix
@@ -0,0 +1,54 @@
+{ stdenv, fetchurl, pcre, libxslt, groff, ncurses, pkgconfig, readline, libedit
+, python2, makeWrapper }:
+
+let
+  common = { version, sha256, extraBuildInputs ? [] }:
+    stdenv.mkDerivation rec {
+      name = "varnish-${version}";
+
+      src = fetchurl {
+        url = "https://varnish-cache.org/_downloads/${name}.tgz";
+        inherit sha256;
+      };
+
+      nativeBuildInputs = [ pkgconfig ];
+      buildInputs = [
+        pcre libxslt groff ncurses readline python2 libedit
+        python2.pkgs.docutils makeWrapper
+      ] ++ extraBuildInputs;
+
+      buildFlags = "localstatedir=/var/spool";
+
+      postInstall = ''
+        wrapProgram "$out/sbin/varnishd" --prefix PATH : "${stdenv.lib.makeBinPath [ stdenv.cc ]}"
+      '';
+
+      # https://github.com/varnishcache/varnish-cache/issues/1875
+      NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isi686 "-fexcess-precision=standard";
+
+      outputs = [ "out" "dev" "man" ];
+
+      meta = with stdenv.lib; {
+        description = "Web application accelerator also known as a caching HTTP reverse proxy";
+        homepage = https://www.varnish-cache.org;
+        license = licenses.bsd2;
+        maintainers = with maintainers; [ garbas fpletz ];
+        platforms = platforms.unix;
+      };
+    };
+in
+{
+  varnish4 = common {
+    version = "4.1.10";
+    sha256 = "08kwx0il6cqxsx3897042plh1yxjaanbaqjbspfl0xgvyvxk6j1n";
+  };
+  varnish5 = common {
+    version = "5.2.1";
+    sha256 = "1cqlj12m426c1lak1hr1fx5zcfsjjvka3hfirz47hvy1g2fjqidq";
+  };
+  varnish6 = common {
+    version = "6.1.1";
+    sha256 = "0gf9hzzrr1lndbbqi8cwlfasi7l517cy3nbgna88i78lm247rvp0";
+    extraBuildInputs = [ python2.pkgs.sphinx ];
+  };
+}
diff --git a/nixpkgs/pkgs/servers/varnish/digest.nix b/nixpkgs/pkgs/servers/varnish/digest.nix
new file mode 100644
index 000000000000..2ccb0419c042
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/digest.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, varnish, libmhash, docutils }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.2";
+  name = "${varnish.name}-digest-${version}";
+
+  src = fetchFromGitHub {
+    owner = "varnish";
+    repo = "libvmod-digest";
+    rev = "libvmod-digest-${version}";
+    sha256 = "0jwkqqalydn0pwfdhirl5zjhbc3hldvhh09hxrahibr72fgmgpbx";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig docutils ];
+  buildInputs = [ varnish libmhash ];
+
+  postPatch = ''
+    substituteInPlace autogen.sh  --replace "''${dataroot}/aclocal"                  "${varnish.dev}/share/aclocal"
+    substituteInPlace Makefile.am --replace "''${LIBVARNISHAPI_DATAROOTDIR}/aclocal" "${varnish.dev}/share/aclocal"
+  '';
+
+  configureFlags = [ "VMOD_DIR=$(out)/lib/varnish/vmods" ];
+
+  doCheck = true;
+
+  meta = with stdenv.lib; {
+    description = "Digest and HMAC vmod";
+    homepage = https://github.com/varnish/libvmod-digest;
+    inherit (varnish.meta) license platforms maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/varnish/dynamic.nix b/nixpkgs/pkgs/servers/varnish/dynamic.nix
new file mode 100644
index 000000000000..711bc1cf78f5
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/dynamic.nix
@@ -0,0 +1,26 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, varnish, python, docutils }:
+
+stdenv.mkDerivation rec {
+  version = "0.3";
+  name = "${varnish.name}-dynamic-${version}";
+
+  src = fetchFromGitHub {
+    owner = "nigoroll";
+    repo = "libvmod-dynamic";
+    rev = "475be183fddbd727c3d2523f0518effa9aa881f8"; # 5.2 branch for Varnish-5.2 https://github.com/nigoroll/libvmod-dynamic/commits/5.2
+    sha256 = "12a42lbv0vf6fn3qnvngw893kmbd006f8pgab4ir7irc8855xjgf";
+  };
+
+  nativeBuildInputs = [ pkgconfig docutils autoreconfHook ];
+  buildInputs = [ varnish python ];
+  postPatch = ''
+    substituteInPlace Makefile.am --replace "''${LIBVARNISHAPI_DATAROOTDIR}/aclocal" "${varnish.dev}/share/aclocal"
+  '';
+  configureFlags = [ "VMOD_DIR=$(out)/lib/varnish/vmods" ];
+
+  meta = with stdenv.lib; {
+    description = "Dynamic director similar to the DNS director from Varnish 3";
+    homepage = https://github.com/nigoroll/libvmod-dynamic;
+    inherit (varnish.meta) license platforms maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/varnish/geoip.nix b/nixpkgs/pkgs/servers/varnish/geoip.nix
new file mode 100644
index 000000000000..d1790252065c
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/geoip.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchpatch, fetchFromGitHub, autoreconfHook, pkgconfig, varnish, geoip, docutils }:
+
+stdenv.mkDerivation rec {
+  version = "1.0.2";
+  name = "${varnish.name}-geoip-${version}";
+
+  src = fetchFromGitHub {
+    owner = "varnish";
+    repo = "libvmod-geoip";
+    rev = "libvmod-geoip-${version}";
+    sha256 = "1gmadayqh3dais14c4skvd47w8h4kyifg7kcw034i0777z5hfpyn";
+  };
+
+  patches = [
+    # IPv6 support
+    (fetchpatch {
+      url = https://github.com/volth/libvmod-geoip-1/commit/0966fe8.patch;
+      sha256 = "053im8h2y8qzs37g95ksr00sf625p23r5ps1j0a2h4lfg70vf4ry";
+    })
+  ];
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig docutils ];
+  buildInputs = [ varnish geoip ];
+  configureFlags = [ "VMOD_DIR=$(out)/lib/varnish/vmods" ];
+
+  meta = with stdenv.lib; {
+    description = "GeoIP Varnish module by Varnish Software";
+    homepage = https://github.com/varnish/libvmod-geoip;
+    inherit (varnish.meta) license platforms maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/varnish/modules.nix b/nixpkgs/pkgs/servers/varnish/modules.nix
new file mode 100644
index 000000000000..7775221d1638
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/modules.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, varnish, python, docutils, removeReferencesTo }:
+
+stdenv.mkDerivation rec {
+  version = "0.14.0";
+  name = "${varnish.name}-modules-${version}";
+
+  src = fetchFromGitHub {
+    owner = "varnish";
+    repo = "varnish-modules";
+    rev = version;
+    sha256 = "17fkbr4i70qgdqsrx1x28ag20xkfyz1v3q3d3ywmv409aczqhm40";
+  };
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook docutils removeReferencesTo ];
+  buildInputs = [ varnish python ];
+
+  postPatch = ''
+    substituteInPlace bootstrap   --replace "''${dataroot}/aclocal"                  "${varnish.dev}/share/aclocal"
+    substituteInPlace Makefile.am --replace "''${LIBVARNISHAPI_DATAROOTDIR}/aclocal" "${varnish.dev}/share/aclocal"
+  '';
+
+  postInstall = "find $out -type f -exec remove-references-to -t ${varnish.dev} '{}' +"; # varnish.dev captured only as __FILE__ in assert messages
+
+  meta = with stdenv.lib; {
+    description = "Collection of Varnish Cache modules (vmods) by Varnish Software";
+    homepage = https://github.com/varnish/varnish-modules;
+    inherit (varnish.meta) license platforms maintainers;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/varnish/packages.nix b/nixpkgs/pkgs/servers/varnish/packages.nix
new file mode 100644
index 000000000000..f468ac58e6cd
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/packages.nix
@@ -0,0 +1,22 @@
+{ callPackage, varnish4, varnish5, varnish6 }:
+
+{
+  varnish4Packages = {
+    varnish = varnish4;
+    digest   = callPackage ./digest.nix   { varnish = varnish4; };
+    rtstatus = callPackage ./rtstatus.nix { varnish = varnish4; }; # varnish4 only
+    modules  = callPackage ./modules.nix  { varnish = varnish4; }; # varnish4 and varnish5 only
+    geoip    = callPackage ./geoip.nix    { varnish = varnish4; }; # varnish4 and varnish5 only
+  };
+  varnish5Packages = {
+    varnish = varnish5;
+    digest   = callPackage ./digest.nix   { varnish = varnish5; };
+    dynamic  = callPackage ./dynamic.nix  { varnish = varnish5; }; # varnish5 only (upstream has a separate branch for varnish4)
+    modules  = callPackage ./modules.nix  { varnish = varnish5; }; # varnish4 and varnish5 only
+    geoip    = callPackage ./geoip.nix    { varnish = varnish5; }; # varnish4 and varnish5 only
+  };
+  varnish6Packages = {
+    varnish = varnish6;
+    digest   = callPackage ./digest.nix   { varnish = varnish6; };
+  };
+}
diff --git a/nixpkgs/pkgs/servers/varnish/rtstatus.nix b/nixpkgs/pkgs/servers/varnish/rtstatus.nix
new file mode 100644
index 000000000000..99c0bb176597
--- /dev/null
+++ b/nixpkgs/pkgs/servers/varnish/rtstatus.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, varnish, python, docutils }:
+
+stdenv.mkDerivation rec {
+  version = "1.2.0";
+  name = "${varnish.name}-rtstatus-${version}";
+
+  src = fetchurl {
+    url = "https://download.varnish-software.com/libvmod-rtstatus/libvmod-rtstatus-${version}.tar.gz";
+    sha256 = "0hll1aspgpv1daw5sdbn5w1d6birchxgapzb6zi1nhahjlimy4ly";
+  };
+
+  nativeBuildInputs = [ pkgconfig docutils ];
+  buildInputs = [ varnish python ];
+  configureFlags = [ "VMOD_DIR=$(out)/lib/varnish/vmods" ];
+
+  meta = with stdenv.lib; {
+    description = "Varnish realtime status page";
+    homepage = https://github.com/varnish/libvmod-rtstatus;
+    inherit (varnish.meta) license platforms maintainers;
+  };
+}