ipcalc: add geoip support
This commit is contained in:
parent
959efb4705
commit
1e698a7979
|
@ -1,14 +1,18 @@
|
||||||
{ lib
|
{ lib
|
||||||
, stdenv
|
, stdenv
|
||||||
, fetchFromGitLab
|
, fetchFromGitLab
|
||||||
, glib
|
|
||||||
, meson
|
, meson
|
||||||
, ninja
|
, ninja
|
||||||
, libmaxminddb
|
|
||||||
, pkg-config
|
, pkg-config
|
||||||
, ronn
|
, 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 {
|
stdenv.mkDerivation rec {
|
||||||
pname = "ipcalc";
|
pname = "ipcalc";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
|
@ -17,22 +21,34 @@ stdenv.mkDerivation rec {
|
||||||
owner = "ipcalc";
|
owner = "ipcalc";
|
||||||
repo = "ipcalc";
|
repo = "ipcalc";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "0qg516jv94dlk0qj0bj5y1dd0i31ziqcjd6m00w8xp5wl97bj2ji";
|
hash = "sha256-UQq5TqK83I44ANU0yXD8YUTQWvBFLiAxmLSRtKUJ5WE=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
# technically not needed as we do not support the paid maxmind databases, but
|
||||||
glib
|
# keep it around if someone wants to add support and /usr/share/GeoIP is
|
||||||
meson
|
# broken anyway
|
||||||
ninja
|
postPatch = ''
|
||||||
pkg-config
|
substituteInPlace ipcalc-maxmind.c \
|
||||||
libmaxminddb
|
--replace /usr/share/GeoIP /var/lib/GeoIP
|
||||||
ronn
|
'';
|
||||||
|
|
||||||
|
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; {
|
meta = with lib; {
|
||||||
description = "Simple IP network calculator";
|
description = "Simple IP network calculator";
|
||||||
homepage = "https://gitlab.com/ipcalc/ipcalc";
|
homepage = "https://gitlab.com/ipcalc/ipcalc";
|
||||||
license = licenses.gpl2Plus;
|
license = licenses.gpl2Plus;
|
||||||
maintainers = with maintainers; [ ];
|
maintainers = with maintainers; [ peterhoeg ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue