quickwit: Enable building UI

Based on patch by Thomas Cheronneau
This commit is contained in:
Jonathan Davies 2024-06-16 18:03:18 +01:00
parent b96d99b63d
commit 773f17e1df
No known key found for this signature in database

View File

@ -7,14 +7,20 @@
, protobuf
, rust-jemalloc-sys
, Security
, nodejs
, yarn
, fetchYarnDeps
, fixup-yarn-lock
}:
let
pname = "quickwit";
version = "0.8.1";
in
rustPlatform.buildRustPackage rec {
inherit pname version;
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${src}/quickwit/quickwit-ui/yarn.lock";
hash = "sha256-HppK9ycUxCOIagvzCmE+VfcmfMQfPIC8WeWM6WbA6fQ=";
};
src = fetchFromGitHub {
owner = "quickwit-oss";
@ -23,6 +29,41 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-B5U9nzXh6kj3/UnQzM3//h4hn9ippWHbeDMcMTP9XfM=";
};
quickwit-ui = stdenv.mkDerivation {
name = "quickwit-ui";
src = "${src}/quickwit/quickwit-ui";
nativeBuildInputs = [
nodejs
yarn
fixup-yarn-lock
];
configurePhase = ''
export HOME=$(mktemp -d)
'';
buildPhase = ''
yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
fixup-yarn-lock yarn.lock
yarn install --offline \
--frozen-lockfile --no-progress \
--ignore-engines --ignore-scripts
patchShebangs .
yarn build
'';
installPhase = ''
mkdir $out
mv build/* $out
'';
};
in
rustPlatform.buildRustPackage rec {
inherit pname version src;
postPatch = ''
substituteInPlace ./quickwit-ingest/build.rs \
--replace-fail '.with_protos' '.with_includes(&["."]).with_protos'
@ -34,6 +75,11 @@ rustPlatform.buildRustPackage rec {
sourceRoot = "${src.name}/quickwit";
preBuild = ''
mkdir -p quickwit-ui/build
cp -r ${quickwit-ui}/* quickwit-ui/build
'';
buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [ Security ];