From b7bdab77eb96fa0548ca23817bf4df44b7318e84 Mon Sep 17 00:00:00 2001 From: Rick van Schijndel Date: Thu, 26 Nov 2020 21:17:17 +0100 Subject: [PATCH 1/2] clamav: enable unit tests, add libjson-c, disable rar explicitly - Add libjson-c dependency for --gen-json functionality. - Disable rar functionality - Because it uses non-free software - Because it doesn't work properly without extra patches - This didn't work before either, but a warning was added about failing to load the rar library - Enable unit tests and add check dependency for that --- pkgs/tools/security/clamav/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/security/clamav/default.nix b/pkgs/tools/security/clamav/default.nix index 3c09951f24f8..d0c9003f1ba2 100644 --- a/pkgs/tools/security/clamav/default.nix +++ b/pkgs/tools/security/clamav/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, pkgconfig , zlib, bzip2, libiconv, libxml2, openssl, ncurses, curl, libmilter, pcre2 -, libmspack, systemd, Foundation +, libmspack, systemd, Foundation, json_c, check }: stdenv.mkDerivation rec { @@ -17,9 +17,10 @@ stdenv.mkDerivation rec { substituteInPlace Makefile.in --replace ' etc ' ' ' ''; + enableParallelBuilding = true; nativeBuildInputs = [ pkgconfig ]; buildInputs = [ - zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter pcre2 libmspack + zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter pcre2 libmspack json_c check ] ++ stdenv.lib.optional stdenv.isLinux systemd ++ stdenv.lib.optional stdenv.isDarwin Foundation; @@ -31,8 +32,11 @@ stdenv.mkDerivation rec { "--with-xml=${libxml2.dev}" "--with-openssl=${openssl.dev}" "--with-libcurl=${curl.dev}" + "--with-libjson=${json_c.dev}" "--with-system-libmspack" "--enable-milter" + "--disable-unrar" # disable unrar because it's non-free and requires some extra patching to work properly + "--enable-check" ] ++ stdenv.lib.optional stdenv.isLinux "--with-systemdsystemunitdir=$(out)/lib/systemd"; @@ -41,6 +45,10 @@ stdenv.mkDerivation rec { cp etc/*.sample $out/etc ''; + # Only required for the unit tests + hardeningDisable = [ "format" ]; + doCheck = true; + meta = with stdenv.lib; { homepage = "https://www.clamav.net"; description = "Antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats"; From 47134948c81280a1dae2181a30cb087347e79ca0 Mon Sep 17 00:00:00 2001 From: Sandro Date: Tue, 8 Dec 2020 03:13:01 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- pkgs/tools/security/clamav/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/security/clamav/default.nix b/pkgs/tools/security/clamav/default.nix index d0c9003f1ba2..e3c57cbc9e90 100644 --- a/pkgs/tools/security/clamav/default.nix +++ b/pkgs/tools/security/clamav/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, pkgconfig +{ stdenv, fetchurl, pkg-config , zlib, bzip2, libiconv, libxml2, openssl, ncurses, curl, libmilter, pcre2 , libmspack, systemd, Foundation, json_c, check }: @@ -18,7 +18,7 @@ stdenv.mkDerivation rec { ''; enableParallelBuilding = true; - nativeBuildInputs = [ pkgconfig ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter pcre2 libmspack json_c check ] ++ stdenv.lib.optional stdenv.isLinux systemd