zipline: refactor environment variables (#377101)
[NixPkgs.git] / pkgs / by-name / li / libcpucycles / package.nix
blob728795aa7f6d67b71b8e6ff9e4ce07e7eaee27e4
2   lib,
3   stdenv,
4   fetchzip,
5   python3,
6   librandombytes,
7 }:
9 stdenv.mkDerivation (finalAttrs: {
10   pname = "libcpucycles";
11   version = "20240318";
13   src = fetchzip {
14     url = "https://cpucycles.cr.yp.to/libcpucycles-${finalAttrs.version}.tar.gz";
15     hash = "sha256-Fb73EOHGgEehZJwTCtCG12xwyiqtDXFs9eFDsHBQiDo=";
16   };
18   patches = [ ./environment-variable-tools.patch ];
20   postPatch = ''
21     patchShebangs configure
22     patchShebangs scripts-build
23   '';
25   nativeBuildInputs = [ python3 ];
27   inherit (librandombytes) hardeningDisable configurePlatforms env;
29   preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
30     install_name_tool -id "$out/lib/libcpucycles.1.dylib" "$out/lib/libcpucycles.1.dylib"
31     install_name_tool -change "libcpucycles.1.dylib" "$out/lib/libcpucycles.1.dylib" "$out/bin/cpucycles-info"
32   '';
34   passthru.updateScript = ./update.sh;
36   meta = {
37     homepage = "https://cpucycles.cr.yp.to/";
38     description = "Microlibrary for counting CPU cycles";
39     changelog = "https://cpucycles.cr.yp.to/download.html";
40     license = with lib.licenses; [
41       # Upstream specifies the public domain licenses with the terms here https://cr.yp.to/spdx.html
42       publicDomain
43       cc0
44       bsd0
45       mit
46       mit0
47     ];
48     maintainers = with lib.maintainers; [
49       kiike
50       imadnyc
51       jleightcap
52     ];
53     inherit (librandombytes.meta) platforms;
54   };