diff options
author | Peter Hoeg <peter@hoeg.com> | 2022-06-28 15:47:23 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2022-07-01 10:10:35 +0800 |
commit | 1e698a79791b81a2da341009fd0ecc15271b2557 (patch) | |
tree | a7c53bd4571e5d18fb442c5150392d496bae53a7 | |
parent | 959efb4705741f193ece980bbc331b10ece725c7 (diff) |
ipcalc: add geoip support
-rw-r--r-- | pkgs/tools/networking/ipcalc/default.nix | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/pkgs/tools/networking/ipcalc/default.nix b/pkgs/tools/networking/ipcalc/default.nix index 2237c739ec147..a29c426b2893b 100644 --- a/pkgs/tools/networking/ipcalc/default.nix +++ b/pkgs/tools/networking/ipcalc/default.nix @@ -1,14 +1,18 @@ { lib , stdenv , fetchFromGitLab -, glib , meson , ninja -, libmaxminddb , pkg-config , ronn +, withGeo ? true +, geoip }: +# In order for the geoip part to work, you need to set up a link from +# geoip.dataDir to a directory containing the data files This would typically be +# /var/lib/geoip-databases pointing to geoip-legacy/share/GeoIP + stdenv.mkDerivation rec { pname = "ipcalc"; version = "1.0.1"; @@ -17,22 +21,34 @@ stdenv.mkDerivation rec { owner = "ipcalc"; repo = "ipcalc"; rev = version; - sha256 = "0qg516jv94dlk0qj0bj5y1dd0i31ziqcjd6m00w8xp5wl97bj2ji"; + hash = "sha256-UQq5TqK83I44ANU0yXD8YUTQWvBFLiAxmLSRtKUJ5WE="; }; - nativeBuildInputs = [ - glib - meson - ninja - pkg-config - libmaxminddb - ronn + # technically not needed as we do not support the paid maxmind databases, but + # keep it around if someone wants to add support and /usr/share/GeoIP is + # broken anyway + postPatch = '' + substituteInPlace ipcalc-maxmind.c \ + --replace /usr/share/GeoIP /var/lib/GeoIP + ''; + + nativeBuildInputs = [ meson ninja pkg-config ronn ]; + + buildInputs = [ geoip ]; + + mesonFlags = [ + "-Duse_geoip=${if withGeo then "en" else "dis"}abled" + "-Duse_maxminddb=disabled" + # runtime linking doesn't work on NixOS anyway + "-Duse_runtime_linking=disabled" ]; + doCheck = true; + meta = with lib; { description = "Simple IP network calculator"; homepage = "https://gitlab.com/ipcalc/ipcalc"; license = licenses.gpl2Plus; - maintainers = with maintainers; [ ]; + maintainers = with maintainers; [ peterhoeg ]; }; } |