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, nix-update-script
14}:
15
16rustPlatform.buildRustPackage rec {
17 pname = "cargo-lambda";
18 version = "1.2.1";
19
20 src = fetchFromGitHub {
21 owner = pname;
22 repo = pname;
23 rev = "v${version}";
24 hash = "sha256-E9jUlEiHyf5UR/UZxJj9LTfyAxGR/WsvRQdFdIVvLG8=";
25 };
26
27 cargoHash = "sha256-IXMkgpyYwll8NwTXRffbsSP5uFHGJe1n2RQ1Mbu+E70=";
28
29 nativeCheckInputs = [cacert];
30
31 nativeBuildInputs = [ makeWrapper pkg-config ];
32
33 buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ curl CoreServices Security ];
34
35 checkFlags = [
36 # Disabled because they access the network.
37 "--skip=test_build_basic_extension"
38 "--skip=test_build_basic_function"
39 "--skip=test_build_basic_zip_extension"
40 "--skip=test_build_basic_zip_function"
41 "--skip=test_build_event_type_function"
42 "--skip=test_build_http_feature_function"
43 "--skip=test_build_http_function"
44 "--skip=test_build_internal_zip_extension"
45 "--skip=test_build_logs_extension"
46 "--skip=test_build_telemetry_extension"
47 "--skip=test_download_example"
48 "--skip=test_init_subcommand"
49 "--skip=test_init_subcommand_without_override"
50 "--skip=test_build_example"
51 "--skip=test_deploy_workspace"
52 ];
53
54 # remove date from version output to make reproducible
55 postPatch = ''
56 rm crates/cargo-lambda-cli/build.rs
57 '';
58
59 postInstall = ''
60 wrapProgram $out/bin/cargo-lambda --prefix PATH : ${lib.makeBinPath [ zig ]}
61 '';
62
63 CARGO_LAMBDA_BUILD_INFO = "(nixpkgs)";
64
65 passthru.updateScript = nix-update-script { };
66
67 meta = with lib; {
68 description = "A Cargo subcommand to help you work with AWS Lambda";
69 mainProgram = "cargo-lambda";
70 homepage = "https://cargo-lambda.info";
71 license = licenses.mit;
72 maintainers = with maintainers; [ taylor1791 calavera ];
73 };
74}