From 242c24c402e9c00a8d3a4ffabe087b5b7e709a55 Mon Sep 17 00:00:00 2001 From: Rodney Lorrimar Date: Sun, 13 Dec 2015 16:36:21 +0000 Subject: [PATCH] fail2ban: python packaging workaround for /etc/fail2ban installation (fixes #11534) Removed path substitutions from setup.py because these should be handled by the setuptools install prefix. Except that the install prefix won't quite work until issue #4968 is resolved. In the meantime there are preInstall and postInstall scripts so that this package continues to work with the nix python packaging improvements. --- pkgs/tools/security/fail2ban/default.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/tools/security/fail2ban/default.nix b/pkgs/tools/security/fail2ban/default.nix index 184f8a59d28c..33638e5f4941 100644 --- a/pkgs/tools/security/fail2ban/default.nix +++ b/pkgs/tools/security/fail2ban/default.nix @@ -18,14 +18,6 @@ pythonPackages.buildPythonPackage { ++ [ python.modules.sqlite3 gamin ]; preConfigure = '' - substituteInPlace setup.cfg \ - --replace /usr $out - - substituteInPlace setup.py \ - --replace /usr $out \ - --replace /etc $out/etc \ - --replace /var $TMPDIR/var \ - for i in fail2ban-client fail2ban-regex fail2ban-server; do substituteInPlace $i \ --replace /usr/share/fail2ban $out/share/fail2ban @@ -40,6 +32,18 @@ pythonPackages.buildPythonPackage { doCheck = false; + preInstall = '' + # see https://github.com/NixOS/nixpkgs/issues/4968 + ${python}/bin/${python.executable} setup.py install_data --install-dir=$out --root=$out + ''; + + postInstall = let + sitePackages = "$out/lib/${python.libPrefix}/site-packages"; + in '' + # see https://github.com/NixOS/nixpkgs/issues/4968 + rm -rf ${sitePackages}/etc ${sitePackages}/usr ${sitePackages}/var; + ''; + meta = with stdenv.lib; { homepage = http://www.fail2ban.org/; description = "A program that scans log files for repeated failing login attempts and bans IP addresses";