2015-11-17 17:30:10 +00:00
|
|
|
{ stdenv, fetchurl, perl, perlPackages, lib, runCommand, postfix }:
|
|
|
|
|
|
|
|
let
|
|
|
|
mk-perl-flags = inputs: lib.concatStringsSep " " (map (dep: "-I ${dep}/lib/perl5/site_perl") inputs);
|
|
|
|
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 18:43:35 +00: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
|
|
|
};
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A postfix policy server to provide greylisting";
|
2017-08-01 20:03:30 +00: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
|
|
|
|
sed -i -e "s,#!/usr/bin/perl -T,#!${perl}/bin/perl -T ${postgrey-flags}," \
|
|
|
|
-e "s#/etc/postfix#$out#" \
|
|
|
|
bin/postgrey
|
|
|
|
sed -i -e "s,#!/usr/bin/perl,#!${perl}/bin/perl ${policy-test-flags}," \
|
|
|
|
bin/policy-test
|
|
|
|
''
|