1{
2 lib,
3 perlPackages,
4 fetchFromGitHub,
5 wrapGAppsHook3,
6 gobject-introspection,
7 perl,
8 clamav,
9}:
10
11perlPackages.buildPerlPackage rec {
12 pname = "clamtk";
13 version = "6.18";
14
15 src = fetchFromGitHub {
16 owner = "dave-theunsub";
17 repo = "clamtk";
18 rev = "v${version}";
19 hash = "sha256-ClBsBXbGj67zgrkA9EjgK7s3OmXOJA+xV5xLGOcMsbI=";
20 };
21
22 nativeBuildInputs = [
23 wrapGAppsHook3
24 gobject-introspection
25 ];
26 buildInputs = [
27 perl
28 clamav
29 ];
30 propagatedBuildInputs = with perlPackages; [
31 Glib
32 LWP
33 LWPProtocolHttps
34 TextCSV
35 JSON
36 LocaleGettext
37 Gtk3
38 ];
39
40 preConfigure = "touch Makefile.PL";
41 # no tests implemented
42 doCheck = false;
43 outputs = [
44 "out"
45 "man"
46 ];
47
48 postPatch = ''
49 # Set correct nix paths in perl scripts
50 substituteInPlace lib/App.pm \
51 --replace /usr/bin/freshclam ${lib.getBin clamav}/bin/freshclam \
52 --replace /usr/bin/sigtool ${lib.getBin clamav}/bin/sigtool \
53 --replace /usr/bin/clamscan ${lib.getBin clamav}/bin/clamscan \
54 --replace /usr/bin/clamdscan ${lib.getBin clamav}/bin/clamdscan \
55 --replace /usr/share/pixmaps $out/share/pixmaps
56
57 # We want to catch the crontab wrapper on NixOS and the
58 # System crontab on non-NixOS so we don't give a full path.
59 substituteInPlace lib/Schedule.pm \
60 --replace "( -e '/usr/bin/crontab' )" "(1)" \
61 --replace /usr/bin/crontab crontab
62 '';
63
64 installPhase = ''
65 runHook preInstall
66
67 install -Dm755 clamtk -t $out/bin
68 install -Dm444 lib/*.pm -t $out/lib/perl5/site_perl/ClamTk
69 install -Dm444 clamtk.desktop -t $out/share/applications
70 install -Dm444 images/* -t $out/share/pixmaps
71 install -Dm444 clamtk.1.gz -t $out/share/man/man1
72 install -Dm444 {CHANGES,LICENSE,*.md} -t $out/share/doc/clamtk
73
74 runHook postInstall
75 '';
76
77 preFixup = ''
78 gappsWrapperArgs+=(
79 --prefix PERL5LIB : $PERL5LIB
80 --set GI_TYPELIB_PATH "$GI_TYPELIB_PATH"
81 )
82 '';
83
84 meta = with lib; {
85 description = ''
86 Easy to use, lightweight front-end for ClamAV (Clam Antivirus).
87 '';
88 mainProgram = "clamtk";
89 license = licenses.gpl1Plus;
90 homepage = "https://github.com/dave-theunsub/clamtk";
91 platforms = platforms.linux;
92 maintainers = with maintainers; [
93 ShamrockLee
94 ];
95 };
96
97}