mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-11 06:34:13 +00:00
![Artturin](/assets/img/avatar_default.png)
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchzip,
|
|
python3,
|
|
librandombytes,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "libcpucycles";
|
|
version = "20240318";
|
|
|
|
src = fetchzip {
|
|
url = "https://cpucycles.cr.yp.to/libcpucycles-${finalAttrs.version}.tar.gz";
|
|
hash = "sha256-Fb73EOHGgEehZJwTCtCG12xwyiqtDXFs9eFDsHBQiDo=";
|
|
};
|
|
|
|
patches = [ ./environment-variable-tools.patch ];
|
|
|
|
postPatch = ''
|
|
patchShebangs configure
|
|
patchShebangs scripts-build
|
|
'';
|
|
|
|
nativeBuildInputs = [ python3 ];
|
|
|
|
inherit (librandombytes) hardeningDisable configurePlatforms env;
|
|
|
|
preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
install_name_tool -id "$out/lib/libcpucycles.1.dylib" "$out/lib/libcpucycles.1.dylib"
|
|
install_name_tool -change "libcpucycles.1.dylib" "$out/lib/libcpucycles.1.dylib" "$out/bin/cpucycles-info"
|
|
'';
|
|
|
|
meta = {
|
|
homepage = "https://cpucycles.cr.yp.to/";
|
|
description = "Microlibrary for counting CPU cycles";
|
|
changelog = "https://cpucycles.cr.yp.to/download.html";
|
|
license = with lib.licenses; [
|
|
# Upstream specifies the public domain licenses with the terms here https://cr.yp.to/spdx.html
|
|
publicDomain
|
|
cc0
|
|
bsd0
|
|
mit
|
|
mit0
|
|
];
|
|
maintainers = with lib.maintainers; [
|
|
kiike
|
|
imadnyc
|
|
jleightcap
|
|
];
|
|
inherit (librandombytes.meta) platforms;
|
|
};
|
|
})
|