Files
nixpkgs/pkgs/development/tools/rust/cargo-lambda/default.nix
T
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

97 lines
2.3 KiB
Nix

{
lib,
cacert,
curl,
rustPlatform,
fetchFromGitHub,
makeWrapper,
pkg-config,
openssl,
stdenv,
CoreServices,
Security,
zig,
nix-update-script,
}:
rustPlatform.buildRustPackage rec {
pname = "cargo-lambda";
version = "1.4.0";
src = fetchFromGitHub {
owner = pname;
repo = pname;
rev = "v${version}";
hash = "sha256-QTFIFD04pAcNgj+ktY8WP0ScDmSy6mNlhfiXAabMlGE=";
};
cargoHash = "sha256-1/+bkxEpIvaJBJatqpX186MHKOdLO8Jiw8NEnyr9ctg=";
nativeCheckInputs = [ cacert ];
nativeBuildInputs = [
makeWrapper
pkg-config
];
buildInputs =
[ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin [
curl
CoreServices
Security
];
checkFlags = [
# Disabled because they access the network.
"--skip=test_build_basic_extension"
"--skip=test_build_basic_function"
"--skip=test_build_basic_zip_extension"
"--skip=test_build_basic_zip_function"
"--skip=test_build_event_type_function"
"--skip=test_build_http_feature_function"
"--skip=test_build_http_function"
"--skip=test_build_internal_zip_extension"
"--skip=test_build_logs_extension"
"--skip=test_build_telemetry_extension"
"--skip=test_build_zip_workspace"
"--skip=test_download_example"
"--skip=test_init_subcommand"
"--skip=test_init_subcommand_without_override"
"--skip=test_build_example"
"--skip=test_deploy_workspace"
"--skip=test_add_files"
"--skip=test_consistent_hash"
"--skip=test_create_binary_archive_from_target"
"--skip=test_create_binary_archive_with_base_path"
"--skip=test_zip_extension"
"--skip=test_zip_funcion"
"--skip=test_zip_funcion_with_files"
"--skip=test_zip_internal_extension"
];
# remove date from version output to make reproducible
postPatch = ''
rm crates/cargo-lambda-cli/build.rs
'';
postInstall = ''
wrapProgram $out/bin/cargo-lambda --prefix PATH : ${lib.makeBinPath [ zig ]}
'';
CARGO_LAMBDA_BUILD_INFO = "(nixpkgs)";
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "Cargo subcommand to help you work with AWS Lambda";
mainProgram = "cargo-lambda";
homepage = "https://cargo-lambda.info";
license = licenses.mit;
maintainers = with maintainers; [
taylor1791
calavera
];
};
}