summary refs log tree commit diff
diff options
context:
space:
mode:
authorVolth <volth@webmaster.ms>2017-07-15 21:50:30 +0000
committerBjørn Forsman <bjorn.forsman@gmail.com>2017-08-19 16:02:19 +0200
commit8b4f5376ff1f1ad6898febe99941bd9a4c890f6b (patch)
treef29090dd7d3dd8b241c8751813ab5890bfa0c864
parent95bb851d80391bd957ce3ea85fa5b1057029fe4f (diff)
downloadnixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.tar
nixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.tar.gz
nixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.tar.bz2
nixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.tar.lz
nixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.tar.xz
nixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.tar.zst
nixpkgs-8b4f5376ff1f1ad6898febe99941bd9a4c890f6b.zip
geoip: set default dir to '/var/lib/geoip-databases'
-rw-r--r--pkgs/development/libraries/geoip/default.nix15
1 files changed, 6 insertions, 9 deletions
diff --git a/pkgs/development/libraries/geoip/default.nix b/pkgs/development/libraries/geoip/default.nix
index bf671ebecd1..60d40b10aa4 100644
--- a/pkgs/development/libraries/geoip/default.nix
+++ b/pkgs/development/libraries/geoip/default.nix
@@ -1,10 +1,10 @@
 # in geoipDatabase, you can insert a package defining ${geoipDatabase}/share/GeoIP
 # e.g. geolite-legacy
-{ stdenv, fetchurl, pkgs, drvName ? "geoip", geoipDatabase ? null }:
+{ stdenv, fetchurl, pkgs, drvName ? "geoip", geoipDatabase ? "/var/lib/geoip-databases" }:
 
-let version = "1.6.2"; in
-
-stdenv.mkDerivation {
+let version = "1.6.2";
+    dataDir = if (stdenv.lib.isDerivation geoipDatabase) then "${toString geoipDatabase}/share/GeoIP" else geoipDatabase;
+in stdenv.mkDerivation {
   name = "${drvName}-${version}";
 
   src = fetchurl {
@@ -12,11 +12,8 @@ stdenv.mkDerivation {
     sha256 = "0dd6si4cvip73kxdn43apg6yygvaf7dnk5awqfg9w2fd2ll0qnh7";
   };
 
-  postInstall = ''
-    DB=${toString geoipDatabase}
-    if [ -n "$DB" ]; then
-      ln -s $DB/share/GeoIP $out/share/GeoIP
-    fi
+  postPatch = ''
+    find . -name Makefile.in -exec sed -i -r 's#^pkgdatadir\s*=.+$#pkgdatadir = ${dataDir}#' {} \;
   '';
 
   meta = {