1{ stdenv
2, lib
3, callPackage
4, fetchFromGitHub
5, rustPlatform
6, nix-update-script
7, darwin
8, openssl
9, pkg-config
10}:
11
12let
13 pname = "edge-runtime";
14 version = "1.14.0";
15in
16rustPlatform.buildRustPackage {
17 inherit pname version;
18
19 src = fetchFromGitHub {
20 owner = "supabase";
21 repo = pname;
22 rev = "v${version}";
23 hash = "sha256-63XStzO4Jt6ObWuzcBf2QwCIWsStXvhQ0XaJabELhWg=";
24 fetchSubmodules = true;
25 };
26
27 cargoHash = "sha256-JwwdvvpqgSbl0Xyb5pQ5hzZRrrCnDSjwV+ikdO2pXCk=";
28
29 nativeBuildInputs = [ pkg-config rustPlatform.bindgenHook ];
30
31 buildInputs = lib.optionals stdenv.isLinux [ openssl ]
32 ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ Security CoreFoundation SystemConfiguration ]);
33
34 # The v8 package will try to download a `librusty_v8.a` release at build time to our read-only filesystem
35 # To avoid this we pre-download the file and export it via RUSTY_V8_ARCHIVE
36 RUSTY_V8_ARCHIVE = callPackage ./librusty_v8.nix { };
37
38 passthru.updateScript = nix-update-script { };
39
40 preCheck = ''
41 export HOME=$(mktemp -d)
42 '';
43
44 checkFlags = [
45 # tries to make a network access
46 "--skip=deno_runtime::test::test_main_rt_fs"
47 "--skip=deno_runtime::test::test_main_runtime_creation"
48 "--skip=deno_runtime::test::test_os_env_vars"
49 "--skip=deno_runtime::test::test_os_ops"
50 "--skip=deno_runtime::test::test_user_runtime_creation"
51 "--skip=test_custom_readable_stream_response"
52 "--skip=test_import_map_file_path"
53 "--skip=test_import_map_inline"
54 "--skip=test_main_worker_options_request"
55 "--skip=test_main_worker_post_request"
56 "--skip=test_null_body_with_204_status"
57 "--skip=test_null_body_with_204_status_post"
58 "--skip=test_file_upload"
59 "--skip=test_oak_server"
60 "--skip=test_tls_throw_invalid_data"
61 "--skip=test_user_worker_json_imports"
62 "--skip=node::analyze::tests::test_esm_code_with_node_globals"
63 "--skip=node::analyze::tests::test_esm_code_with_node_globals_with_shebang"
64 ];
65
66 meta = with lib; {
67 description = "A server based on Deno runtime, capable of running JavaScript, TypeScript, and WASM services";
68 homepage = "https://github.com/supabase/edge-runtime";
69 license = licenses.mit;
70 maintainers = with maintainers; [ happysalada ];
71 };
72}