mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-11 22:54:17 +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" ```
78 lines
1.6 KiB
Nix
78 lines
1.6 KiB
Nix
{ lib
|
|
, rustPlatform
|
|
, fetchFromGitHub
|
|
, pkg-config
|
|
, installShellFiles
|
|
, bzip2
|
|
, openssl
|
|
, xz
|
|
, zstd
|
|
, stdenv
|
|
, darwin
|
|
, testers
|
|
, espup
|
|
}:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "espup";
|
|
version = "0.12.2";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "esp-rs";
|
|
repo = "espup";
|
|
rev = "v${version}";
|
|
hash = "sha256-7rxT3Stbfec7oxZOBN87lICmq+V8OZMCXb5F6Ca6jS4=";
|
|
};
|
|
|
|
cargoHash = "sha256-GfoM2ngwnovQdbiEUQrkrrMpq4fo37VVOmnkK/5l+C8=";
|
|
|
|
nativeBuildInputs = [
|
|
pkg-config
|
|
installShellFiles
|
|
];
|
|
|
|
buildInputs = [
|
|
bzip2
|
|
openssl
|
|
xz
|
|
zstd
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
darwin.apple_sdk.frameworks.CoreFoundation
|
|
darwin.apple_sdk.frameworks.Security
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
|
];
|
|
|
|
env = {
|
|
OPENSSL_NO_VENDOR = true;
|
|
ZSTD_SYS_USE_PKG_CONFIG = true;
|
|
};
|
|
|
|
preCheck = ''
|
|
export HOME=$(mktemp -d)
|
|
'';
|
|
|
|
checkFlags = [
|
|
# makes network calls
|
|
"--skip=toolchain::rust::tests::test_xtensa_rust_parse_version"
|
|
];
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd espup \
|
|
--bash <($out/bin/espup completions bash) \
|
|
--fish <($out/bin/espup completions fish) \
|
|
--zsh <($out/bin/espup completions zsh)
|
|
'';
|
|
|
|
passthru.tests.version = testers.testVersion {
|
|
package = espup;
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Tool for installing and maintaining Espressif Rust ecosystem";
|
|
homepage = "https://github.com/esp-rs/espup/";
|
|
license = with licenses; [ mit asl20 ];
|
|
maintainers = with maintainers; [ knightpp beeb ];
|
|
mainProgram = "espup";
|
|
};
|
|
}
|