grafana-alloy: 1.11.3 -> 1.12.1

Grafana Alloy's frontend uses a npm lock file now
This commit is contained in:
Christian Simon
2026-01-12 21:09:57 +02:00
committed by Florian Klink
parent bc40151885
commit 3ada6e2a16
+30 -42
View File
@@ -2,12 +2,9 @@
lib,
stdenv,
fetchFromGitHub,
fetchYarnDeps,
buildGoModule,
buildNpmPackage,
systemd,
yarn,
fixup-yarn-lock,
nodejs,
grafana-alloy,
nixosTests,
nix-update-script,
@@ -17,24 +14,39 @@
useLLD ? stdenv.hostPlatform.isArmv7,
}:
buildGoModule (finalAttrs: {
buildGoModule (finalAttrs: rec {
pname = "grafana-alloy";
version = "1.11.3";
version = "1.12.1";
src = fetchFromGitHub {
owner = "grafana";
repo = "alloy";
tag = "v${finalAttrs.version}";
hash = "sha256-yO1r7GLXlD7f5Fpooit7SwkB7EB1hDO42o3BLvWY8Qo=";
hash = "sha256-DfezWaLbCty8FiFA+oEqiDoZ1QKIdYGtywQ6t2vm/N0=";
};
frontend =
let
fsrc = "${src}/internal/web/ui";
in
buildNpmPackage {
pname = "alloy-frontend";
inherit version;
src = fsrc;
npmDepsHash = "sha256-mEcPH+kuj+o60sK+JsRAwHauT7vHnZQZ+KBhKcDSeok=";
installPhase = ''
mkdir $out
cp -av dist $out/share
'';
};
proxyVendor = true;
vendorHash = "sha256-8n1r2Wun5ZSvjsU2Vl/fSRoQnTfKbrcQI6a7YDX/HZA=";
vendorHash = "sha256-pZNPJ4rSsvOHubCYKx+CblOUwI6eb6ckHwzRRtyRNu4=";
nativeBuildInputs = [
fixup-yarn-lock
yarn
nodejs
installShellFiles
]
++ lib.optionals useLLD [ lld ];
@@ -62,39 +74,15 @@ buildGoModule (finalAttrs: {
"promtail_journal_enabled"
];
patchPhase = ''
# Copy frontend build in
cp -va "${frontend}/share" "internal/web/ui/dist"
'';
subPackages = [
"."
];
# Skip building the frontend in the goModules FOD
overrideModAttrs = (
_: {
preBuild = null;
}
);
yarnOfflineCache = fetchYarnDeps {
yarnLock = "${finalAttrs.src}/internal/web/ui/yarn.lock";
hash = "sha256-oCDP2XJczLXgzEjyvFEIFBanlnzjrj0So09izG5vufs=";
};
preBuild = ''
pushd internal/web/ui
# Yarn wants a real home directory to write cache, config, etc to
export HOME=$NIX_BUILD_TOP/fake_home
fixup-yarn-lock yarn.lock
yarn config --offline set yarn-offline-mirror ${finalAttrs.yarnOfflineCache}
yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive
patchShebangs node_modules/
yarn --offline build
popd
'';
# uses go-systemd, which uses libsystemd headers
# https://github.com/coreos/go-systemd/issues/351
NIX_CFLAGS_COMPILE = lib.optionals stdenv.hostPlatform.isLinux [
@@ -139,7 +127,7 @@ buildGoModule (finalAttrs: {
];
};
# alias for nix-update to be able to find and update this attribute
offlineCache = finalAttrs.yarnOfflineCache;
inherit frontend;
};
meta = {