1{ lib, stdenv, fetchurl, pkg-config, cmake
2, zlib, bzip2, libiconv, libxml2, openssl, ncurses, curl, libmilter, pcre2
3, libmspack, systemd, Foundation, json_c, check
4, rustc, rust-bindgen, rustfmt, cargo, python3
5}:
6
7stdenv.mkDerivation rec {
8 pname = "clamav";
9 version = "1.1.0";
10
11 src = fetchurl {
12 url = "https://www.clamav.net/downloads/production/${pname}-${version}.tar.gz";
13 hash = "sha256-owAg2ZzUZ/peoO+9b08YLv6/Yqn8YvxKOnssw/Vea3Q=";
14 };
15
16 patches = [
17 # Flaky test, remove this when https://github.com/Cisco-Talos/clamav/issues/343 is fixed
18 ./remove-freshclam-test.patch
19 ./sample-cofiguration-file-install-location.patch
20 ];
21
22 enableParallelBuilding = true;
23 nativeBuildInputs = [ cmake pkg-config rustc rust-bindgen rustfmt cargo python3 ];
24 buildInputs = [
25 zlib bzip2 libxml2 openssl ncurses curl libiconv libmilter pcre2 libmspack json_c check
26 ] ++ lib.optional stdenv.isLinux systemd
27 ++ lib.optional stdenv.isDarwin Foundation;
28
29 cmakeFlags = [
30 "-DSYSTEMD_UNIT_DIR=${placeholder "out"}/lib/systemd"
31 "-DAPP_CONFIG_DIRECTORY=/etc/clamav"
32 ];
33
34 doCheck = true;
35
36 meta = with lib; {
37 homepage = "https://www.clamav.net";
38 description = "Antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats";
39 license = licenses.gpl2;
40 maintainers = with maintainers; [ robberer qknight globin ];
41 platforms = platforms.unix;
42 };
43}