2021-01-25 08:26:54 +00:00
|
|
|
{ fetchurl, perlPackages, lib, runCommand, postfix }:
|
2015-11-17 17:30:10 +00:00
|
|
|
|
|
|
|
let
|
2018-12-15 03:50:31 +00:00
|
|
|
mk-perl-flags = inputs: lib.concatStringsSep " " (map (dep: "-I ${dep}/${perlPackages.perl.libPrefix}") inputs);
|
2015-11-17 17:30:10 +00:00
|
|
|
postgrey-flags = mk-perl-flags (with perlPackages; [
|
|
|
|
NetServer BerkeleyDB DigestSHA1 NetAddrIP IOMultiplex
|
|
|
|
]);
|
|
|
|
policy-test-flags = mk-perl-flags (with perlPackages; [
|
|
|
|
ParseSyslog
|
|
|
|
]);
|
2018-02-27 19:31:29 +00:00
|
|
|
version = "1.37";
|
2015-11-17 17:30:10 +00:00
|
|
|
name = "postgrey-${version}";
|
|
|
|
in runCommand name {
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://postgrey.schweikert.ch/pub/${name}.tar.gz";
|
2018-02-27 19:31:29 +00:00
|
|
|
sha256 = "1xx51xih4711vrvc6d57il9ccallbljj5zhgqdb07jzmz11rakgz";
|
2015-11-17 17:30:10 +00:00
|
|
|
};
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2015-11-17 17:30:10 +00:00
|
|
|
description = "A postfix policy server to provide greylisting";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://postgrey.schweikert.ch/";
|
2015-11-17 17:30:10 +00:00
|
|
|
platforms = postfix.meta.platforms;
|
2017-12-05 22:20:11 +00:00
|
|
|
license = licenses.gpl2;
|
2015-11-17 17:30:10 +00:00
|
|
|
};
|
|
|
|
} ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cd $out
|
|
|
|
tar -xzf $src --strip-components=1
|
|
|
|
mv postgrey policy-test bin
|
2018-12-15 03:50:31 +00:00
|
|
|
sed -i -e "s,#!/usr/bin/perl -T,#!${perlPackages.perl}/bin/perl -T ${postgrey-flags}," \
|
2015-11-17 17:30:10 +00:00
|
|
|
-e "s#/etc/postfix#$out#" \
|
|
|
|
bin/postgrey
|
2018-12-15 03:50:31 +00:00
|
|
|
sed -i -e "s,#!/usr/bin/perl,#!${perlPackages.perl}/bin/perl ${policy-test-flags}," \
|
2015-11-17 17:30:10 +00:00
|
|
|
bin/policy-test
|
|
|
|
''
|