3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/libraries/howard-hinnant-date/default.nix
Cole Helbling 25057960ce
howard-hinnant-date: allow access to zoneinfo
This fixes the situtation where, if `/usr/share/zoneinfo` was
inaccessible/didn't otherwise exist, `howard-hinnant-date` would
download and drop a `~/Downloads/tzdata` directory containing some
timezone information from IANA [1]. To avoid this, we make use of the
`tzdata`'s `zoneinfo`, preventing the dropping of random directories and
files.

[1] https://data.iana.org/time-zones/releases/tzdata2019c.tar.gz
2020-03-02 22:48:52 -08:00

47 lines
1.4 KiB
Nix

{ stdenv, fetchFromGitHub, cmake, curl, tzdata, fetchpatch, substituteAll }:
stdenv.mkDerivation rec {
pname = "howard-hinnant-date-unstable";
version = "2020-01-24";
src = fetchFromGitHub {
owner = "HowardHinnant";
repo = "date";
rev = "9a0ee2542848ab8625984fc8cdbfb9b5414c0082";
sha256 = "0yxsn0hj22n61bjywysxqgfv7hj5xvsl6isma95fl8xrimpny083";
};
patches = [
(fetchpatch {
url = "https://github.com/HowardHinnant/date/commit/e56b2dce7e89a92e1b9b35caa13b3e938c4cedea.patch";
sha256 = "0m3qbhq7kmm9qa3jm6d2px7c1dxdj5k9lffgdvqnrwmhxwj1p9n2";
})
# Without this patch, this library will drop a `tzdata` directory into
# `~/Downloads` if it cannot find `/usr/share/zoneinfo`. Make the path it
# searches for `zoneinfo` be the one from the `tzdata` package.
(substituteAll {
src = ./make-zoneinfo-available.diff;
inherit tzdata;
})
];
nativeBuildInputs = [ cmake ];
buildInputs = [ curl ];
cmakeFlags = [
"-DBUILD_TZ_LIB=true"
"-DBUILD_SHARED_LIBS=true"
"-DUSE_SYSTEM_TZ_DB=true"
];
outputs = [ "out" "dev" ];
meta = with stdenv.lib; {
license = licenses.mit;
description = "A date and time library based on the C++11/14/17 <chrono> header";
homepage = "https://github.com/HowardHinnant/date";
platforms = platforms.linux;
maintainers = with maintainers; [ ma27 ];
};
}