lol

libfaketime: use date from nix store (#115212)

Previously the faketime command used date (or gdate on darwin) from the environment. This led to issues when the date command was not available or did not behave as expected.
Thus, we patch libfaketime to use the date binary from the Nix coreutils package, pulling it into the closure.

authored by

Finn Behrens and committed by
GitHub
b2e2f042 b0146430

+32 -1
+3 -1
pkgs/development/libraries/libfaketime/default.nix
··· 1 - { lib, stdenv, fetchurl, perl }: 1 + { lib, stdenv, fetchurl, perl, coreutils }: 2 2 3 3 stdenv.mkDerivation rec { 4 4 pname = "libfaketime"; ··· 11 11 12 12 patches = [ 13 13 ./no-date-in-gzip-man-page.patch 14 + ./nix-store-date.patch 14 15 ] ++ (lib.optionals stdenv.cc.isClang [ 15 16 # https://github.com/wolfcw/libfaketime/issues/277 16 17 ./0001-Remove-unsupported-clang-flags.patch ··· 22 23 substituteInPlace $a \ 23 24 --replace /bin/bash ${stdenv.shell} 24 25 done 26 + substituteInPlace src/faketime.c --replace @DATE_CMD@ ${coreutils}/bin/date 25 27 ''; 26 28 27 29 PREFIX = placeholder "out";
+29
pkgs/development/libraries/libfaketime/nix-store-date.patch
··· 1 + From abd7dd05b440e3dc9621a1579e4afb0267897d9c Mon Sep 17 00:00:00 2001 2 + From: Finn Behrens <me@kloenk.de> 3 + Date: Fri, 5 Mar 2021 21:58:57 +0100 4 + Subject: [PATCH] use nix date path 5 + 6 + --- 7 + src/faketime.c | 6 +----- 8 + 1 file changed, 1 insertion(+), 5 deletions(-) 9 + 10 + diff --git a/src/faketime.c b/src/faketime.c 11 + index af618f2..48e47da 100644 12 + --- a/src/faketime.c 13 + +++ b/src/faketime.c 14 + @@ -50,11 +50,7 @@ 15 + 16 + const char version[] = "0.9.9"; 17 + 18 + -#ifdef __APPLE__ 19 + -static const char *date_cmd = "gdate"; 20 + -#else 21 + -static const char *date_cmd = "date"; 22 + -#endif 23 + +static const char *date_cmd = "@DATE_CMD@"; 24 + 25 + #define PATH_BUFSIZE 4096 26 + 27 + -- 28 + 2.24.3 (Apple Git-128) 29 +