forked from NixOS/nixpkgs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
pkgs/servers/monitoring/openobserve/openobserve/build.rs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/build.rs b/build.rs | ||
index 0f66ace..be74fad 100644 | ||
--- a/build.rs | ||
+++ b/build.rs | ||
@@ -99,24 +99,5 @@ fn main() -> Result<()> { | ||
&["proto"], | ||
)?; | ||
|
||
- // build information | ||
- let output = Command::new("git") | ||
- .args(["describe", "--tags", "--abbrev=0"]) | ||
- .output() | ||
- .unwrap(); | ||
- let git_tag = String::from_utf8(output.stdout).unwrap(); | ||
- println!("cargo:rustc-env=GIT_VERSION={git_tag}"); | ||
- | ||
- let output = Command::new("git") | ||
- .args(["rev-parse", "HEAD"]) | ||
- .output() | ||
- .unwrap(); | ||
- let git_commit = String::from_utf8(output.stdout).unwrap(); | ||
- println!("cargo:rustc-env=GIT_COMMIT_HASH={git_commit}"); | ||
- | ||
- let now: DateTime<Utc> = Utc::now(); | ||
- let build_date = now.to_rfc3339_opts(SecondsFormat::Secs, true); | ||
- println!("cargo:rustc-env=GIT_BUILD_DATE={build_date}"); | ||
- | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
{ | ||
lib, | ||
rustPlatform, | ||
fetchFromGitHub, | ||
pkg-config, | ||
protobuf, | ||
bzip2, | ||
oniguruma, | ||
sqlite, | ||
xz, | ||
zlib, | ||
zstd, | ||
buildNpmPackage, | ||
gitUpdater, | ||
}: | ||
|
||
let | ||
version = "0.14.0"; | ||
src = fetchFromGitHub { | ||
owner = "openobserve"; | ||
repo = "openobserve"; | ||
tag = "v${version}"; | ||
hash = "sha256-rTp+DkADqYkJg1zJog1yURE082V5kCqgid/oUd81SN8="; | ||
}; | ||
web = buildNpmPackage { | ||
inherit src version; | ||
pname = "openobserve-ui"; | ||
|
||
sourceRoot = "${src.name}/web"; | ||
|
||
npmDepsHash = "sha256-awfQR1wZBX3ggmD0uJE9Fur4voPydeygrviRijKnBTE="; | ||
|
||
preBuild = '' | ||
# Patch vite config to not open the browser to visualize plugin composition | ||
substituteInPlace vite.config.ts \ | ||
--replace "open: true" "open: false"; | ||
''; | ||
|
||
env = { | ||
NODE_OPTIONS = "--max-old-space-size=8192"; | ||
# cypress tries to download binaries otherwise | ||
CYPRESS_INSTALL_BINARY = 0; | ||
}; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out/share | ||
mv dist $out/share/openobserve-ui | ||
runHook postInstall | ||
''; | ||
}; | ||
in | ||
rustPlatform.buildRustPackage { | ||
pname = "openobserve"; | ||
inherit version src; | ||
|
||
patches = [ | ||
# prevent using git to determine version info during build time | ||
./build.rs.patch | ||
]; | ||
|
||
preBuild = '' | ||
cp -r ${web}/share/openobserve-ui web/dist | ||
''; | ||
|
||
useFetchCargoVendor = true; | ||
cargoHash = "sha256-FWMUPghx9CxuzP7jFZYSIwZsylApWzQsfx8DuwS4GTo="; | ||
|
||
nativeBuildInputs = [ | ||
pkg-config | ||
protobuf | ||
]; | ||
|
||
buildInputs = [ | ||
bzip2 | ||
oniguruma | ||
sqlite | ||
xz | ||
zlib | ||
zstd | ||
]; | ||
|
||
env = { | ||
RUSTONIG_SYSTEM_LIBONIG = true; | ||
ZSTD_SYS_USE_PKG_CONFIG = true; | ||
|
||
RUSTC_BOOTSTRAP = 1; # uses experimental features | ||
|
||
# the patched build.rs file sets these variables | ||
GIT_VERSION = src.tag; | ||
GIT_COMMIT_HASH = "builtByNix"; | ||
GIT_BUILD_DATE = "1970-01-01T00:00:00Z"; | ||
}; | ||
|
||
# requires network access or filesystem mutations | ||
checkFlags = [ | ||
"--skip=handler::http::router::tests::test_get_proxy_routes" | ||
"--skip=tests::e2e_test" | ||
]; | ||
|
||
passthru.updateScript = gitUpdater { | ||
rev-prefix = "v"; | ||
ignoredVersions = "rc"; | ||
}; | ||
|
||
meta = { | ||
description = "Cloud-native observability platform built specifically for logs, metrics, traces, analytics & realtime user-monitoring"; | ||
homepage = "https://github.com/openobserve/openobserve"; | ||
changelog = "https://github.com/openobserve/openobserve/releases/tag/v${version}"; | ||
license = lib.licenses.asl20; | ||
maintainers = with lib.maintainers; [ happysalada ]; | ||
mainProgram = "openobserve"; | ||
}; | ||
} |