nixpkgs/pkgs/by-name/cl/clamtk/package.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d5c88a98d674f637d092807cfc12253.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
2025-04-08 02:57:25 -04:00

98 lines
2.3 KiB
Nix

{
lib,
perlPackages,
fetchFromGitHub,
wrapGAppsHook3,
gobject-introspection,
perl,
clamav,
}:
perlPackages.buildPerlPackage rec {
pname = "clamtk";
version = "6.18";
src = fetchFromGitHub {
owner = "dave-theunsub";
repo = "clamtk";
rev = "v${version}";
hash = "sha256-ClBsBXbGj67zgrkA9EjgK7s3OmXOJA+xV5xLGOcMsbI=";
};
nativeBuildInputs = [
wrapGAppsHook3
gobject-introspection
];
buildInputs = [
perl
clamav
];
propagatedBuildInputs = with perlPackages; [
Glib
LWP
LWPProtocolHttps
TextCSV
JSON
LocaleGettext
Gtk3
];
preConfigure = "touch Makefile.PL";
# no tests implemented
doCheck = false;
outputs = [
"out"
"man"
];
postPatch = ''
# Set correct nix paths in perl scripts
substituteInPlace lib/App.pm \
--replace /usr/bin/freshclam ${lib.getBin clamav}/bin/freshclam \
--replace /usr/bin/sigtool ${lib.getBin clamav}/bin/sigtool \
--replace /usr/bin/clamscan ${lib.getBin clamav}/bin/clamscan \
--replace /usr/bin/clamdscan ${lib.getBin clamav}/bin/clamdscan \
--replace /usr/share/pixmaps $out/share/pixmaps
# We want to catch the crontab wrapper on NixOS and the
# System crontab on non-NixOS so we don't give a full path.
substituteInPlace lib/Schedule.pm \
--replace "( -e '/usr/bin/crontab' )" "(1)" \
--replace /usr/bin/crontab crontab
'';
installPhase = ''
runHook preInstall
install -Dm755 clamtk -t $out/bin
install -Dm444 lib/*.pm -t $out/lib/perl5/site_perl/ClamTk
install -Dm444 clamtk.desktop -t $out/share/applications
install -Dm444 images/* -t $out/share/pixmaps
install -Dm444 clamtk.1.gz -t $out/share/man/man1
install -Dm444 {CHANGES,LICENSE,*.md} -t $out/share/doc/clamtk
runHook postInstall
'';
preFixup = ''
gappsWrapperArgs+=(
--prefix PERL5LIB : $PERL5LIB
--set GI_TYPELIB_PATH "$GI_TYPELIB_PATH"
)
'';
meta = with lib; {
description = ''
Easy to use, lightweight front-end for ClamAV (Clam Antivirus).
'';
mainProgram = "clamtk";
license = licenses.gpl1Plus;
homepage = "https://github.com/dave-theunsub/clamtk";
platforms = platforms.linux;
maintainers = with maintainers; [
ShamrockLee
];
};
}