lol
1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 rustPlatform,
6 nixosTests,
7 nix-update-script,
8 protobuf,
9 rust-jemalloc-sys,
10 nodejs,
11 yarn,
12 fetchYarnDeps,
13 fixup-yarn-lock,
14}:
15
16let
17 pname = "quickwit";
18 version = "0.8.2";
19
20 yarnOfflineCache = fetchYarnDeps {
21 yarnLock = "${src}/quickwit/quickwit-ui/yarn.lock";
22 hash = "sha256-HppK9ycUxCOIagvzCmE+VfcmfMQfPIC8WeWM6WbA6fQ=";
23 };
24
25 src = fetchFromGitHub {
26 owner = "quickwit-oss";
27 repo = "quickwit";
28 rev = "v${version}";
29 hash = "sha256-OrCO0mCFmhYBdpr4Gps56KJJ37uuJpV6ZJHWspOScyw=";
30 };
31
32 quickwit-ui = stdenv.mkDerivation {
33 name = "quickwit-ui";
34 src = "${src}/quickwit/quickwit-ui";
35
36 nativeBuildInputs = [
37 nodejs
38 yarn
39 fixup-yarn-lock
40 ];
41
42 configurePhase = ''
43 export HOME=$(mktemp -d)
44 '';
45
46 buildPhase = ''
47 yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
48 fixup-yarn-lock yarn.lock
49
50 yarn install --offline \
51 --frozen-lockfile --no-progress \
52 --ignore-engines --ignore-scripts
53 patchShebangs .
54
55 yarn build
56 '';
57
58 installPhase = ''
59 mkdir $out
60 mv build/* $out
61 '';
62 };
63in
64rustPlatform.buildRustPackage rec {
65 inherit pname version src;
66
67 postPatch = ''
68 substituteInPlace ./quickwit-ingest/build.rs \
69 --replace-fail '.with_protos' '.with_includes(&["."]).with_protos'
70 substituteInPlace ./quickwit-codegen/example/build.rs \
71 --replace-fail '.with_protos' '.with_includes(&["."]).with_protos'
72 substituteInPlace ./quickwit-proto/build.rs \
73 --replace-fail '.with_protos' '.with_includes(&["."]).with_protos'
74 cp /build/cargo-vendor-dir/Cargo.lock /build/source/quickwit/Cargo.lock
75 '';
76
77 sourceRoot = "${src.name}/quickwit";
78
79 preBuild = ''
80 mkdir -p quickwit-ui/build
81 cp -r ${quickwit-ui}/* quickwit-ui/build
82 '';
83
84 buildInputs = [
85 rust-jemalloc-sys
86 ];
87
88 cargoLock = {
89 lockFile = ./Cargo.lock;
90 outputHashes = {
91 "chitchat-0.8.0" = "sha256-6K2noPoFaDnOxQIEV1WbmVPfRGwlI/WS1OWSBH2qb1Q=";
92 "mrecordlog-0.4.0" = "sha256-9LIVs+BqK9FLSfHL3vm9LL+/FXIXJ6v617QLv4luQik=";
93 "ownedbytes-0.6.0" = "sha256-in18/NYYIgUiZ9sm8NgJlebWidRp34DR7AhOD1Nh0aw=";
94 "pulsar-5.0.2" = "sha256-j7wpsAro6x4fk3pvSL4fxLkddJFq8duZ7jDj0Edf3YQ=";
95 "sasl2-sys-0.1.20+2.1.28" = "sha256-u4BsfmTDFxuY3i1amLCsr7MDv356YPThMHclura0Sxs=";
96 "whichlang-0.1.0" = "sha256-7AvLGjtWHjG0TnZdg9p5D+O0H19uo2sqPxJMn6mOU0k=";
97 };
98 };
99
100 CARGO_PROFILE_RELEASE_LTO = "fat";
101 CARGO_PROFILE_RELEASE_CODEGEN_UNITS = "1";
102
103 # needed for internal protobuf c wrapper library
104 PROTOC = "${protobuf}/bin/protoc";
105 PROTOC_INCLUDE = "${protobuf}/include";
106
107 passthru = {
108 tests = {
109 inherit (nixosTests) quickwit;
110 inherit (nixosTests.vector) syslog-quickwit;
111 };
112 updateScript = nix-update-script { };
113 };
114
115 checkFlags = [
116 # tries to make a network access
117 "--skip=test_all_local_index"
118 "--skip=test_cmd_create"
119 "--skip=test_cmd_create_no_index_uri"
120 "--skip=test_cmd_search_aggregation"
121 "--skip=test_cmd_search_with_snippets"
122 "--skip=test_delete_index_cli"
123 "--skip=test_delete_index_cli_dry_run"
124 "--skip=test_ingest_docs_cli"
125 "--skip=test_ingest_docs_cli_keep_cache"
126 "--skip=test_search_index_cli"
127 "--skip=test_garbage_collect_cli_no_grace"
128 "--skip=actors::indexing_service::tests::test_indexing_service_spawn_observe_detach"
129 "--skip=object_storage::s3_compatible_storage::tests::test_s3_compatible_storage_relative_path"
130 # flaky test
131 "--skip=actors::indexer::tests::test_indexer_triggers_commit_on_drained_mailbox"
132 "--skip=actors::indexer::tests::test_indexer_triggers_commit_on_timeout"
133 "--skip=actors::indexer::tests::test_indexer_partitioning"
134 "--skip=actors::indexing_pipeline::tests::test_merge_pipeline_does_not_stop_on_indexing_pipeline_failure"
135 "--skip=actors::indexer::tests::test_indexer_triggers_commit_on_target_num_docs"
136 "--skip=actors::packager::tests::test_packager_simple"
137 # fail on darwin for some reason
138 "--skip=io::tests::test_controlled_writer_limited_async"
139 "--skip=io::tests::test_controlled_writer_limited_sync"
140 ];
141
142 meta = with lib; {
143 description = "Sub-second search & analytics engine on cloud storage";
144 homepage = "https://quickwit.io/";
145 license = licenses.agpl3Only;
146 maintainers = with maintainers; [ happysalada ];
147 platforms = platforms.all;
148 };
149}