grafana-agent: build and embed flow mode web ui
This commit is contained in:
parent
9e1960bc19
commit
cc4dcc08be
|
@ -1,11 +1,15 @@
|
|||
{ lib
|
||||
, buildGoModule
|
||||
, fetchFromGitHub
|
||||
, fetchYarnDeps
|
||||
, fixup_yarn_lock
|
||||
, grafana-agent
|
||||
, nixosTests
|
||||
, nodejs
|
||||
, stdenv
|
||||
, systemd
|
||||
, testers
|
||||
, yarn
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
|
@ -22,6 +26,11 @@ buildGoModule rec {
|
|||
vendorHash = "sha256-MqUkGKOzx8Qo9xbD9GdUryVwKjpVUOXFo2x0/2uz8Uk=";
|
||||
proxyVendor = true; # darwin/linux hash mismatch
|
||||
|
||||
frontendYarnOfflineCache = fetchYarnDeps {
|
||||
yarnLock = src + "/web/ui/yarn.lock";
|
||||
hash = "sha256-xJEPubIDjlZQL70UGha1MHbeek6KFPaxZGb5IRgMlTA=";
|
||||
};
|
||||
|
||||
ldflags = let
|
||||
prefix = "github.com/grafana/agent/pkg/build";
|
||||
in [
|
||||
|
@ -34,7 +43,10 @@ buildGoModule rec {
|
|||
"-X ${prefix}.BuildDate=1980-01-01T00:00:00Z"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [ fixup_yarn_lock nodejs yarn ];
|
||||
|
||||
tags = [
|
||||
"builtinassets"
|
||||
"nonetwork"
|
||||
"nodocker"
|
||||
"promtail_journal_enabled"
|
||||
|
@ -43,8 +55,21 @@ buildGoModule rec {
|
|||
subPackages = [
|
||||
"cmd/grafana-agent"
|
||||
"cmd/grafana-agentctl"
|
||||
"web/ui"
|
||||
];
|
||||
|
||||
preBuild = ''
|
||||
export HOME="$TMPDIR"
|
||||
|
||||
pushd web/ui
|
||||
fixup_yarn_lock yarn.lock
|
||||
yarn config --offline set yarn-offline-mirror $frontendYarnOfflineCache
|
||||
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
|
||||
patchShebangs node_modules
|
||||
yarn --offline run build
|
||||
popd
|
||||
'';
|
||||
|
||||
# uses go-systemd, which uses libsystemd headers
|
||||
# https://github.com/coreos/go-systemd/issues/351
|
||||
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.isLinux [ "-I${lib.getDev systemd}/include" ]);
|
||||
|
|
Loading…
Reference in a new issue