1 { lib, stdenv, fetchurl, pcre, pcre2, jemalloc, libunwind, libxslt, groff, ncurses, pkg-config, readline, libedit
2 , coreutils, python3, makeWrapper, nixosTests }:
5 common = { version, hash, extraNativeBuildInputs ? [] }:
6 stdenv.mkDerivation rec {
11 url = "https://varnish-cache.org/_downloads/${pname}-${version}.tgz";
15 nativeBuildInputs = with python3.pkgs; [ pkg-config docutils sphinx makeWrapper];
17 libxslt groff ncurses readline libedit python3
19 ++ lib.optional (lib.versionOlder version "7") pcre
20 ++ lib.optional (lib.versionAtLeast version "7") pcre2
21 ++ lib.optional stdenv.hostPlatform.isDarwin libunwind
22 ++ lib.optional stdenv.hostPlatform.isLinux jemalloc;
24 buildFlags = [ "localstatedir=/var/spool" ];
27 substituteInPlace bin/varnishtest/vtc_main.c --replace /bin/rm "${coreutils}/bin/rm"
31 wrapProgram "$out/sbin/varnishd" --prefix PATH : "${lib.makeBinPath [ stdenv.cc ]}"
34 # https://github.com/varnishcache/varnish-cache/issues/1875
35 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isi686 "-fexcess-precision=standard";
37 outputs = [ "out" "dev" "man" ];
41 tests = nixosTests."varnish${builtins.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor version)}";
45 description = "Web application accelerator also known as a caching HTTP reverse proxy";
46 homepage = "https://www.varnish-cache.org";
47 license = licenses.bsd2;
49 platforms = platforms.unix;
57 hash = "sha256-DcpilfnGnUenIIWYxBU4XFkMZoY+vUK/6wijZ7eIqbo=";
62 hash = "sha256-/KYbmDE54arGHEVG0SoaOrmAfbsdgxRXHjFIyT/3K10=";