nixpkgs/pkgs/tools/networking/ipcalc/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.3 KiB
Nix
Raw Normal View History

2021-08-30 11:30:09 +02:00
{ lib
, stdenv
, fetchFromGitLab
, meson
, ninja
, pkg-config
, ronn
2022-06-28 09:47:23 +02:00
, withGeo ? true
, geoip
2021-08-30 11:30:09 +02:00
}:
2022-06-28 09:47:23 +02:00
# 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
2015-02-05 16:46:50 +01:00
stdenv.mkDerivation rec {
pname = "ipcalc";
2021-08-30 11:30:09 +02:00
version = "1.0.1";
src = fetchFromGitLab {
owner = "ipcalc";
repo = "ipcalc";
rev = version;
2022-06-28 09:47:23 +02:00
hash = "sha256-UQq5TqK83I44ANU0yXD8YUTQWvBFLiAxmLSRtKUJ5WE=";
2015-02-05 16:46:50 +01:00
};
2021-08-30 11:30:09 +02:00
2022-06-28 09:47:23 +02:00
# 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"
2021-08-30 11:30:09 +02:00
];
2022-06-28 09:47:23 +02:00
doCheck = true;
2021-08-30 11:30:09 +02:00
meta = with lib; {
2015-02-05 16:46:50 +01:00
description = "Simple IP network calculator";
2021-08-30 11:30:09 +02:00
homepage = "https://gitlab.com/ipcalc/ipcalc";
license = licenses.gpl2Plus;
2022-06-28 09:47:23 +02:00
maintainers = with maintainers; [ peterhoeg ];
2015-02-05 16:46:50 +01:00
};
}