mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +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" ```
36 lines
1.1 KiB
Nix
36 lines
1.1 KiB
Nix
{ lib, stdenv, rustPlatform, fetchFromGitHub, pkg-config
|
|
, openssl, libiconv, CoreServices, Security, SystemConfiguration }:
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "trunk-ng";
|
|
version = "0.17.16";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "ctron";
|
|
repo = "trunk";
|
|
rev = "v${version}";
|
|
hash = "sha256-SnE0z9Wa4gtX/ts0vG9pYnnxumILHTSV9/tVYkCHFck=";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
buildInputs = if stdenv.hostPlatform.isDarwin
|
|
then [ libiconv CoreServices Security SystemConfiguration ]
|
|
else [ openssl ];
|
|
|
|
# requires network
|
|
checkFlags = [ "--skip=tools::tests::download_and_install_binaries" ];
|
|
|
|
cargoHash = {
|
|
darwin = "sha256-TwpGw3LH3TmZSbC4DkoOYpQdOpksXXoAoiacyZAefTU=";
|
|
linux = "sha256-AivISmT/r8xa/vSXUN8sU7z67t1hcyMQM+t6oXmIOhU=";
|
|
}.${stdenv.hostPlatform.parsed.kernel.name} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/ctron/trunk";
|
|
description = "Build, bundle & ship your Rust WASM application to the web";
|
|
mainProgram = "trunk-ng";
|
|
maintainers = with maintainers; [ ctron ];
|
|
license = with licenses; [ asl20 ];
|
|
};
|
|
}
|