ca5ab3a501
GitOrigin-RevId: 4a01ca36d6bfc133bc617e661916a81327c9bbc8
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ lib
|
|
, stdenv
|
|
, fetchFromGitLab
|
|
, meson
|
|
, ninja
|
|
, 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";
|
|
|
|
src = fetchFromGitLab {
|
|
owner = "ipcalc";
|
|
repo = "ipcalc";
|
|
rev = version;
|
|
hash = "sha256-UQq5TqK83I44ANU0yXD8YUTQWvBFLiAxmLSRtKUJ5WE=";
|
|
};
|
|
|
|
# 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; [ peterhoeg ];
|
|
};
|
|
}
|