mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-11 22:54:17 +00:00
e0464e4788
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" ```
64 lines
1.6 KiB
Nix
64 lines
1.6 KiB
Nix
{ lib
|
|
, stdenv
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, ruby
|
|
, which
|
|
, nix-update-script
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "rbspy";
|
|
version = "0.25.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "rbspy";
|
|
repo = "rbspy";
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-6J+/clldoMSTcZXM4N8THZ3fk2NE9VQ2XyDIzVej6OY=";
|
|
};
|
|
|
|
cargoHash = "sha256-u42FDaSpunkj5u1zYtk27tKunW4ZzsNgYCmrSnuAe5k=";
|
|
|
|
# error: linker `aarch64-linux-gnu-gcc` not found
|
|
postPatch = ''
|
|
rm .cargo/config
|
|
'';
|
|
|
|
doCheck = true;
|
|
|
|
# The current implementation of rbspy fails to detect the version of ruby
|
|
# from nixpkgs during tests.
|
|
preCheck = ''
|
|
substituteInPlace src/core/process.rs \
|
|
--replace /usr/bin/which '${which}/bin/which'
|
|
substituteInPlace src/sampler/mod.rs \
|
|
--replace /usr/bin/which '${which}/bin/which'
|
|
'';
|
|
|
|
checkFlags = [
|
|
"--skip=test_get_trace"
|
|
"--skip=test_get_trace_when_process_has_exited"
|
|
"--skip=test_sample_single_process"
|
|
"--skip=test_sample_single_process_with_time_limit"
|
|
"--skip=test_sample_subprocesses"
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
ruby
|
|
which
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin rustPlatform.bindgenHook;
|
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
meta = with lib; {
|
|
homepage = "https://rbspy.github.io/";
|
|
description = "Sampling CPU Profiler for Ruby";
|
|
mainProgram = "rbspy";
|
|
changelog = "https://github.com/rbspy/rbspy/releases/tag/v${version}";
|
|
license = licenses.mit;
|
|
maintainers = with maintainers; [ viraptor ];
|
|
platforms = platforms.linux ++ platforms.darwin;
|
|
};
|
|
}
|