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.18.1";
18
19 src = fetchFromGitHub {
20 owner = pname;
21 repo = pname;
22 rev = "v${version}";
23 sha256 = "sha256-un+GQflxhMHCMH5UEeUVsYx59ryn7MR4ApooeOuhccc=";
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 accesses the network.
41 "--skip=test_build_basic_extension"
42 "--skip=test_build_basic_function"
43 "--skip=test_build_http_function"
44 "--skip=test_build_logs_extension"
45 "--skip=test_build_telemetry_extension"
46 "--skip=test_download_example"
47 "--skip=test_init_subcommand"
48 "--skip=test_init_subcommand_without_override"
49 ];
50
51 # remove date from version output to make reproducible
52 postPatch = ''
53 rm crates/cargo-lambda-cli/build.rs
54 '';
55
56 postInstall = ''
57 wrapProgram $out/bin/cargo-lambda --prefix PATH : ${lib.makeBinPath [ zig ]}
58 '';
59
60 CARGO_LAMBDA_BUILD_INFO = "(nixpkgs)";
61
62 meta = with lib; {
63 description = "A Cargo subcommand to help you work with AWS Lambda";
64 homepage = "https://cargo-lambda.info";
65 license = licenses.mit;
66 maintainers = with maintainers; [ taylor1791 calavera ];
67 };
68}