diff --git a/pkgs/development/libraries/libmilter/default.nix b/pkgs/development/libraries/libmilter/default.nix index 9287b0a0dea7..38788b3c964b 100644 --- a/pkgs/development/libraries/libmilter/default.nix +++ b/pkgs/development/libraries/libmilter/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, m4 }: +{ lib, stdenv, fetchurl, m4, fixDarwinDylibNames }: stdenv.mkDerivation rec { pname = "libmilter"; @@ -34,7 +34,11 @@ stdenv.mkDerivation rec { patches = [ ./install.patch ./sharedlib.patch ./glibc-2.30.patch ./darwin.patch ]; - nativeBuildInputs = [ m4 ]; + nativeBuildInputs = [ m4 ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + + postInstall = lib.optionalString stdenv.isDarwin '' + fixDarwinDylibNames $out/lib/libmilter.dylib.1 + ''; meta = with lib; { description = "Sendmail Milter mail filtering API library"; diff --git a/pkgs/development/python-modules/pymilter/default.nix b/pkgs/development/python-modules/pymilter/default.nix new file mode 100644 index 000000000000..0724161bf423 --- /dev/null +++ b/pkgs/development/python-modules/pymilter/default.nix @@ -0,0 +1,40 @@ +{ lib, python, buildPythonPackage, fetchFromGitHub, libmilter, bsddb3, pydns, iana-etc, libredirect }: + +buildPythonPackage rec { + pname = "pymilter"; + version = "1.0.5"; + + src = fetchFromGitHub { + owner = "sdgathman"; + repo = pname; + rev = "${pname}-${version}"; + hash = "sha256-gZUWEDVZfDRiOOdG3lpiQldHxm/93l8qYVOHOEpHhzQ="; + }; + + buildInputs = [ libmilter ]; + propagatedBuildInputs = [ bsddb3 pydns ]; + + preBuild = '' + sed -i 's/import thread/import _thread as thread/' Milter/greylist.py + ''; + + # requires /etc/resolv.conf + # testpolicy: requires makemap (#100419) + # using exec -a makemap smtpctl results in "unknown group smtpq" + preCheck = '' + echo "nameserver 127.0.0.1" > resolv.conf + export NIX_REDIRECTS=/etc/protocols=${iana-etc}/etc/protocols:/etc/resolv.conf=$(realpath resolv.conf) + export LD_PRELOAD=${libredirect}/lib/libredirect.so + sed -i '/testpolicy/d' test.py + rm testpolicy.py + ''; + + pythonImportsCheck = [ "Milter" ]; + + meta = with lib; { + homepage = "http://bmsi.com/python/milter.html"; + description = "Python bindings for libmilter api"; + maintainers = with maintainers; [ yorickvp ]; + license = licenses.gpl2; + }; +} diff --git a/pkgs/servers/mail/pypolicyd-spf/default.nix b/pkgs/servers/mail/pypolicyd-spf/default.nix deleted file mode 100644 index cbc63ff535a1..000000000000 --- a/pkgs/servers/mail/pypolicyd-spf/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ lib, buildPythonApplication, fetchurl, pyspf }: - -buildPythonApplication rec { - pname = "pypolicyd-spf"; - majorVersion = "2.0"; - version = "${majorVersion}.2"; - - src = fetchurl { - url = "https://launchpad.net/pypolicyd-spf/${majorVersion}/${version}/+download/${pname}-${version}.tar.gz"; - sha256 = "1nm8y1jjgx6mxrbcxrbdnmkf8vglwp0wiw6jipzh641wb24gi76z"; - }; - - propagatedBuildInputs = [ pyspf ]; - - preBuild = '' - substituteInPlace setup.py --replace "'/etc'" "'$out/etc'" - ''; - - meta = with lib; { - homepage = "https://launchpad.net/pypolicyd-spf/"; - description = "Postfix policy engine for Sender Policy Framework (SPF) checking"; - maintainers = with maintainers; [ abbradar ]; - license = licenses.asl20; - platforms = platforms.all; - }; -} diff --git a/pkgs/servers/mail/spf-engine/default.nix b/pkgs/servers/mail/spf-engine/default.nix new file mode 100644 index 000000000000..0f2e98582514 --- /dev/null +++ b/pkgs/servers/mail/spf-engine/default.nix @@ -0,0 +1,30 @@ +{ lib, buildPythonApplication, fetchurl, pyspf, dnspython, authres, pymilter }: + +buildPythonApplication rec { + pname = "spf-engine"; + version = "2.9.3"; + + src = fetchurl { + url = "https://launchpad.net/${pname}/${lib.versions.majorMinor version}/${version}/+download/${pname}-${version}.tar.gz"; + sha256 = "sha256-w0Nb+L/Os3KPApENoylxCVaCD4FvgmvpfVvwCkt2IDE="; + }; + + propagatedBuildInputs = [ pyspf dnspython authres pymilter ]; + + pythonImportsCheck = [ + "spf_engine" + "spf_engine.milter_spf" + "spf_engine.policyd_spf" + ]; + + postPatch = '' + substituteInPlace setup.py --replace "'/etc'" "'$out/etc'" + ''; + + meta = with lib; { + homepage = "https://launchpad.net/spf-engine/"; + description = "Postfix policy engine for Sender Policy Framework (SPF) checking"; + maintainers = with maintainers; [ abbradar ]; + license = licenses.asl20; + }; +} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index f944705333b3..a28f2799458b 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1234,6 +1234,7 @@ mapAliases ({ pyload = throw "pyload has been removed from nixpkgs, as it was unmaintained"; # Added 2021-03-21 pynagsystemd = throw "pynagsystemd was removed as it was unmaintained and incompatible with recent systemd versions. Instead use its fork check_systemd"; # Added 2020-10-24 pyo3-pack = maturin; + pypolicyd-spf = spf-engine; # Added 2022-10-09 pyrex = throw "pyrex has been removed from nixpkgs as the project is still stuck on python2"; # Added 2022-01-12 pyrex095 = throw "pyrex has been removed from nixpkgs as the project is still stuck on python2"; # Added 2022-01-12 pyrex096 = throw "pyrex has been removed from nixpkgs as the project is still stuck on python2"; # Added 2022-01-12 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 3ec6c4f421b0..e104b1719d4c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24383,7 +24383,7 @@ with pkgs; pure-ftpd = callPackage ../servers/ftp/pure-ftpd { }; - pypolicyd-spf = python3.pkgs.callPackage ../servers/mail/pypolicyd-spf { }; + spf-engine = python3.pkgs.callPackage ../servers/mail/spf-engine { }; pypiserver = with python3Packages; toPythonApplication pypiserver; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b05da5787304..d119be13e323 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8144,6 +8144,8 @@ self: super: with self; { pymicrobot = callPackage ../development/python-modules/pymicrobot { }; + pymilter = callPackage ../development/python-modules/pymilter { }; + pymitv = callPackage ../development/python-modules/pymitv { }; pymfy = callPackage ../development/python-modules/pymfy { };