1{ lib, stdenv, fetchFromGitHub, perl, coreutils }:
2
3stdenv.mkDerivation rec {
4 pname = "libfaketime";
5 version = "0.9.9";
6
7 src = fetchFromGitHub {
8 owner = "wolfcw";
9 repo = "libfaketime";
10 rev = "v${version}";
11 sha256 = "sha256-P1guVggteGtoq8+eeE966hDPkRwsn0m7oLCohyPrIb4=";
12 };
13
14 patches = [
15 ./no-date-in-gzip-man-page.patch
16 ./nix-store-date.patch
17 ] ++ (lib.optionals stdenv.cc.isClang [
18 # https://github.com/wolfcw/libfaketime/issues/277
19 ./0001-Remove-unsupported-clang-flags.patch
20 ]);
21
22 postPatch = ''
23 patchShebangs test src
24 for a in test/functests/test_exclude_mono.sh src/faketime.c ; do
25 substituteInPlace $a \
26 --replace /bin/bash ${stdenv.shell}
27 done
28 substituteInPlace src/faketime.c --replace @DATE_CMD@ ${coreutils}/bin/date
29 '';
30
31 PREFIX = placeholder "out";
32 LIBDIRNAME = "/lib";
33
34 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=cast-function-type -Wno-error=format-truncation";
35
36 checkInputs = [ perl ];
37
38 meta = with lib; {
39 description = "Report faked system time to programs without having to change the system-wide time";
40 homepage = "https://github.com/wolfcw/libfaketime/";
41 license = licenses.gpl2;
42 platforms = platforms.all;
43 maintainers = [ maintainers.bjornfor ];
44 mainProgram = "faketime";
45 };
46}