about summary refs log tree commit diff
path: root/pkgs/tools/security/fail2ban
diff options
context:
space:
mode:
authorRodney Lorrimar <dev@rodney.id.au>2015-12-13 16:36:21 +0000
committerRodney Lorrimar <dev@rodney.id.au>2015-12-18 09:44:22 +0000
commit242c24c402e9c00a8d3a4ffabe087b5b7e709a55 (patch)
treed0a59a48e3457b6f301ed4ca65df7feeab8ae6cd /pkgs/tools/security/fail2ban
parent2eb8c3e491f7431e65fc2ea43c7f6949fca2d6ad (diff)
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.
Diffstat (limited to 'pkgs/tools/security/fail2ban')
-rw-r--r--pkgs/tools/security/fail2ban/default.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/pkgs/tools/security/fail2ban/default.nix b/pkgs/tools/security/fail2ban/default.nix
index 184f8a59d28c8..33638e5f49414 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";