From 905bcfabe10c5dfc823f2769c2fb8632adca8927 Mon Sep 17 00:00:00 2001 From: K900 Date: Sun, 28 Jan 2024 15:36:21 +0300 Subject: [PATCH 1/2] grafana: fix frontend build on aarch64 I think it works on x86_64 because it fallback to the prebuilt version and they only added prebuilt ARM binaries in 2.2.0 https://github.com/parcel-bundler/watcher/commit/062bca4887f17a2f448c11a99bfc2f826eb98c3e - @tgerbet --- pkgs/servers/monitoring/grafana/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/monitoring/grafana/default.nix b/pkgs/servers/monitoring/grafana/default.nix index 3b4d930d4537..53ca53651243 100644 --- a/pkgs/servers/monitoring/grafana/default.nix +++ b/pkgs/servers/monitoring/grafana/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, buildGoModule, fetchFromGitHub, removeReferencesTo , tzdata, wire -, yarn, nodejs, cacert +, yarn, nodejs, python3, cacert , jq, moreutils , nix-update-script, nixosTests }: @@ -74,7 +74,7 @@ buildGoModule rec { vendorHash = "sha256-Gf2A22d7/8xU/ld7kveqGonVKGFCArGNansPRGhfyXM="; - nativeBuildInputs = [ wire yarn jq moreutils removeReferencesTo ]; + nativeBuildInputs = [ wire yarn jq moreutils removeReferencesTo python3 ]; postPatch = '' ${patchAwayGrafanaE2E} @@ -121,6 +121,14 @@ buildGoModule rec { # Setup node_modules export HOME="$(mktemp -d)" + + # Help node-gyp find Node.js headers + # (see https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/javascript.section.md#pitfalls-javascript-yarn2nix-pitfalls) + mkdir -p $HOME/.node-gyp/${nodejs.version} + echo 9 > $HOME/.node-gyp/${nodejs.version}/installVersion + ln -sfv ${nodejs}/include $HOME/.node-gyp/${nodejs.version} + export npm_config_nodedir=${nodejs} + yarn config set enableTelemetry 0 yarn config set cacheFolder $offlineCache yarn --immutable-cache From 4ed50a508c2aa09c5e9f0ee707a39ddfe1c4c618 Mon Sep 17 00:00:00 2001 From: K900 Date: Sun, 28 Jan 2024 16:56:01 +0300 Subject: [PATCH 2/2] grafana: download more ram --- pkgs/servers/monitoring/grafana/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/servers/monitoring/grafana/default.nix b/pkgs/servers/monitoring/grafana/default.nix index 53ca53651243..fcb3c1f2ed3b 100644 --- a/pkgs/servers/monitoring/grafana/default.nix +++ b/pkgs/servers/monitoring/grafana/default.nix @@ -132,6 +132,9 @@ buildGoModule rec { yarn config set enableTelemetry 0 yarn config set cacheFolder $offlineCache yarn --immutable-cache + + # The build OOMs on memory constrained aarch64 without this + export NODE_OPTIONS=--max_old_space_size=4096 ''; postBuild = ''