nixpkgs/pkgs/by-name/li/libfaketime/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

56 lines
1.8 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchpatch, perl, coreutils }:
stdenv.mkDerivation rec {
pname = "libfaketime";
version = "0.9.10";
src = fetchFromGitHub {
owner = "wolfcw";
repo = "libfaketime";
rev = "v${version}";
sha256 = "sha256-DYRuQmIhQu0CNEboBAtHOr/NnWxoXecuPMSR/UQ/VIQ=";
};
patches = [
./nix-store-date.patch
(fetchpatch {
name = "0001-libfaketime.c-wrap-timespec_get-in-TIME_UTC-macro.patch";
url = "https://github.com/wolfcw/libfaketime/commit/e0e6b79568d36a8fd2b3c41f7214769221182128.patch";
sha256 = "sha256-KwwP76v0DXNW73p/YBvwUOPdKMAcVdbQSKexD/uFOYo=";
})
(fetchpatch {
name = "LFS64.patch";
url = "https://github.com/wolfcw/libfaketime/commit/f32986867addc9d22b0fab29c1c927f079d44ac1.patch";
hash = "sha256-fIXuxxcV9J2IcgwcwSrMo4maObkH9WYv1DC/wdtbq/g=";
})
] ++ (lib.optionals stdenv.cc.isClang [
# https://github.com/wolfcw/libfaketime/issues/277
./0001-Remove-unsupported-clang-flags.patch
]);
postPatch = ''
patchShebangs test src
for a in test/functests/test_exclude_mono.sh src/faketime.c ; do
substituteInPlace $a \
--replace /bin/bash ${stdenv.shell}
done
substituteInPlace src/faketime.c --replace @DATE_CMD@ ${coreutils}/bin/date
'';
PREFIX = placeholder "out";
LIBDIRNAME = "/lib";
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=cast-function-type -Wno-error=format-truncation";
nativeCheckInputs = [ perl ];
meta = with lib; {
description = "Report faked system time to programs without having to change the system-wide time";
homepage = "https://github.com/wolfcw/libfaketime/";
license = licenses.gpl2;
platforms = platforms.all;
maintainers = [ maintainers.bjornfor ];
mainProgram = "faketime";
};
}