nixpkgs/pkgs/by-name/ca/cargo-information/package.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

66 lines
1.6 KiB
Nix

{ lib
, rustPlatform
, fetchFromGitHub
, makeWrapper
, pkg-config
, openssl
, curl
, rustc
, stdenv
, darwin
}:
rustPlatform.buildRustPackage rec {
pname = "cargo-information";
version = "0.7.0";
src = fetchFromGitHub {
owner = "hi-rustin";
repo = "cargo-information";
rev = "v${version}";
hash = "sha256-gu1t0jMBJ+mJIVMGy1JlabzcOT4lbmTvO/VQfxLLsWM=";
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"cargo-test-macro-0.2.1" = "sha256-3sergm2T4VXT41ERCLL7p9+pJwIKzT54qdla8V58Psk=";
};
};
checkFlags = [
# Require network access
"--skip=cargo_information::specify_version_within_ws_and_match_with_lockfile::case"
"--skip=cargo_information::within_ws::case"
"--skip=cargo_information::within_ws_with_alternative_registry::case"
"--skip=cargo_information::within_ws_without_lockfile::case"
"--skip=cargo_information::transitive_dependency_within_ws::case"
];
nativeBuildInputs = [
pkg-config
makeWrapper
];
buildInputs = [
openssl
curl
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.apple_sdk.frameworks.Security
];
postFixup = ''
wrapProgram $out/bin/cargo-info \
--prefix PATH : ${lib.makeBinPath [ rustc ]}
'';
meta = with lib; {
description = "Cargo subcommand to show information about crates";
mainProgram = "cargo-info";
homepage = "https://github.com/hi-rustin/cargo-information";
changelog = "https://github.com/hi-rustin/cargo-information/blob/v${src.rev}/CHANGELOG.md";
license = licenses.mit;
maintainers = with maintainers; [ eopb ];
};
}