From 6dd5c9ee3f236cb118bf74417ef03ed319b769c8 Mon Sep 17 00:00:00 2001 From: emilylange Date: Wed, 28 Feb 2024 18:22:34 +0100 Subject: [PATCH] grafana-agent: add `passthru.updateScript` `nix-update` has support for `fetchYarnDeps` via the attribute name `offlineCache`. Our yarn FOD is called `frontendYarnOfflineCache`, which I find more descriptive and would like to keep this way. To work around this requirement, this adds an alias in `passthru`. The addition of `passthru.updateScript` also allows `nixpkgs-update` to update this package when the yarn FOD hash needs to be updated. See the following error from the last `nixpkgs-update` run: https://r.ryantm.com/log/grafana-agent/2024-02-27.log --- .../monitoring/grafana-agent/default.nix | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/pkgs/servers/monitoring/grafana-agent/default.nix b/pkgs/servers/monitoring/grafana-agent/default.nix index 6ddaf2ba07a2..a2506ef1a594 100644 --- a/pkgs/servers/monitoring/grafana-agent/default.nix +++ b/pkgs/servers/monitoring/grafana-agent/default.nix @@ -2,10 +2,11 @@ , buildGoModule , fetchFromGitHub , fetchYarnDeps -, prefetch-yarn-deps , grafana-agent +, nix-update-script , nixosTests , nodejs +, prefetch-yarn-deps , stdenv , systemd , testers @@ -89,13 +90,18 @@ buildGoModule rec { $out/bin/grafana-agent ''; - passthru.tests = { - inherit (nixosTests) grafana-agent; - version = testers.testVersion { - inherit version; - command = "${lib.getExe grafana-agent} --version"; - package = grafana-agent; + passthru = { + tests = { + inherit (nixosTests) grafana-agent; + version = testers.testVersion { + inherit version; + command = "${lib.getExe grafana-agent} --version"; + package = grafana-agent; + }; }; + updateScript = nix-update-script { }; + # alias for nix-update to be able to find and update this attribute + offlineCache = frontendYarnOfflineCache; }; meta = {