1{ lib
2, cacert
3, curl
4, rustPlatform
5, fetchFromGitHub
6, makeWrapper
7, pkg-config
8, openssl
9, stdenv
10, CoreServices
11, Security
12, zig
13}:
14
15rustPlatform.buildRustPackage rec {
16 pname = "cargo-lambda";
17 version = "0.21.1";
18
19 src = fetchFromGitHub {
20 owner = pname;
21 repo = pname;
22 rev = "v${version}";
23 hash = "sha256-QlTAYfd0taXfK370nzqictwK7bZ4bnh1oPBJKZzhnMo=";
24 };
25
26 cargoLock = {
27 lockFile = ./Cargo.lock;
28 outputHashes = {
29 "cargo-test-macro-0.1.0" = "sha256-XvTKAbP/r1BthpEM84CYZ2yfJczxqzscGkN4JXLgvfA=";
30 };
31 };
32
33 nativeCheckInputs = [cacert];
34
35 nativeBuildInputs = [ makeWrapper pkg-config ];
36
37 buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ curl CoreServices Security ];
38
39 checkFlags = [
40 # Disabled because they access the network.
41 "--skip=test_build_basic_extension"
42 "--skip=test_build_basic_function"
43 "--skip=test_build_basic_zip_extension"
44 "--skip=test_build_basic_zip_function"
45 "--skip=test_build_event_type_function"
46 "--skip=test_build_http_feature_function"
47 "--skip=test_build_http_function"
48 "--skip=test_build_internal_zip_extension"
49 "--skip=test_build_logs_extension"
50 "--skip=test_build_telemetry_extension"
51 "--skip=test_download_example"
52 "--skip=test_init_subcommand"
53 "--skip=test_init_subcommand_without_override"
54 ];
55
56 # remove date from version output to make reproducible
57 postPatch = ''
58 rm crates/cargo-lambda-cli/build.rs
59 '';
60
61 postInstall = ''
62 wrapProgram $out/bin/cargo-lambda --prefix PATH : ${lib.makeBinPath [ zig ]}
63 '';
64
65 CARGO_LAMBDA_BUILD_INFO = "(nixpkgs)";
66
67 meta = with lib; {
68 description = "A Cargo subcommand to help you work with AWS Lambda";
69 homepage = "https://cargo-lambda.info";
70 license = licenses.mit;
71 maintainers = with maintainers; [ taylor1791 calavera ];
72 };
73}