nixpkgs/pkgs/tools/system/logcheck/default.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

48 lines
1.7 KiB
Nix

{ lib, stdenv, fetchurl, lockfileProgs, perlPackages }:
stdenv.mkDerivation rec {
pname = "logcheck";
version = "1.3.20";
_name = "logcheck_${version}";
src = fetchurl {
url = "mirror://debian/pool/main/l/logcheck/${_name}.tar.xz";
sha256 = "1rmkvxhcwr9gb6z4dlgr6rrx5l70hshlxdggs6qx0w1ljcmx1dlz";
};
prePatch = ''
# do not set sticky bit in nix store.
substituteInPlace Makefile --replace 2750 0750
'';
preConfigure = ''
substituteInPlace src/logtail --replace "/usr/bin/perl" "${perlPackages.perl}/bin/perl"
substituteInPlace src/logtail2 --replace "/usr/bin/perl" "${perlPackages.perl}/bin/perl"
sed -i -e 's|! -f /usr/bin/lockfile|! -f ${lockfileProgs}/bin/lockfile|' \
-e 's|^\([ \t]*\)lockfile-|\1${lockfileProgs}/bin/lockfile-|' \
-e "s|/usr/sbin/logtail2|$out/sbin/logtail2|" \
-e 's|mime-construct|${perlPackages.mimeConstruct}/bin/mime-construct|' \
-e 's|\$(run-parts --list "\$dir")|"$dir"/*|' src/logcheck
'';
makeFlags = [
"DESTDIR=$(out)"
"SBINDIR=sbin"
"BINDIR=bin"
"SHAREDIR=share/logtail/detectrotate"
];
meta = with lib; {
description = "Mails anomalies in the system logfiles to the administrator";
longDescription = ''
Mails anomalies in the system logfiles to the administrator.
Logcheck helps spot problems and security violations in your logfiles automatically and will send the results to you by e-mail.
Logcheck was part of the Abacus Project of security tools, but this version has been rewritten.
'';
homepage = "https://salsa.debian.org/debian/logcheck";
license = licenses.gpl2;
maintainers = [ maintainers.bluescreen303 ];
};
}