From e28d4b75e9b5368dfac682b69e2358a968803f77 Mon Sep 17 00:00:00 2001 From: Dimitar Nestorov <8790386+dimitarnestorov@users.noreply.github.com> Date: Tue, 28 Apr 2026 23:28:32 +0300 Subject: [PATCH] grafana: fix for Yarn 4.14 --- pkgs/by-name/gr/grafana/package.nix | 10 ++++++-- .../gr/grafana/yarn-4.14-support.patch | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 pkgs/by-name/gr/grafana/yarn-4.14-support.patch diff --git a/pkgs/by-name/gr/grafana/package.nix b/pkgs/by-name/gr/grafana/package.nix index c44a93d6695d..23e9ba8915b8 100644 --- a/pkgs/by-name/gr/grafana/package.nix +++ b/pkgs/by-name/gr/grafana/package.nix @@ -36,6 +36,12 @@ buildGoModule (finalAttrs: { hash = "sha256-fGRvCDIOQcF743SimatyNmX0gZtO0tvgEAFuk38rl88="; }; + patches = [ + # Remove after upstream updates to Yarn 4.14 + # https://github.com/grafana/grafana/blob/main/package.json#L483 + ./yarn-4.14-support.patch + ]; + # borrowed from: https://github.com/NixOS/nixpkgs/blob/d70d9425f49f9aba3c49e2c389fe6d42bac8c5b0/pkgs/development/tools/analysis/snyk/default.nix#L20-L22 env = { CYPRESS_INSTALL_BINARY = 0; @@ -48,8 +54,8 @@ buildGoModule (finalAttrs: { missingHashes = ./missing-hashes.json; # Since this is not a dependency attribute the buildPackages has to be specified. offlineCache = buildPackages.yarn-berry_4-fetcher.fetchYarnBerryDeps { - inherit (finalAttrs) src missingHashes; - hash = "sha256-5aInVAn9UMGp8U+LEIR1D19RI9vKVrNpt5Frbr1sBJs="; + inherit (finalAttrs) src missingHashes patches; + hash = "sha256-l+X7vgU+wuuq+Usdp0ffY1SpT70QlmdsjrHnyyJufjw="; }; disallowedRequisites = [ finalAttrs.offlineCache ]; diff --git a/pkgs/by-name/gr/grafana/yarn-4.14-support.patch b/pkgs/by-name/gr/grafana/yarn-4.14-support.patch new file mode 100644 index 000000000000..6d3be05a1c1e --- /dev/null +++ b/pkgs/by-name/gr/grafana/yarn-4.14-support.patch @@ -0,0 +1,23 @@ +diff --git a/.yarnrc.yml b/.yarnrc.yml +--- a/.yarnrc.yml ++++ b/.yarnrc.yml +@@ -25,6 +25,7 @@ plugins: + path: .yarn/plugins/@yarnpkg/plugin-licenses.cjs + spec: "https://raw.githubusercontent.com/mhassan1/yarn-plugin-licenses/v0.15.0/bundles/@yarnpkg/plugin-licenses.js" + +-yarnPath: .yarn/releases/yarn-4.11.0.cjs ++approvedGitRepositories: ++ - "**" + + enableScripts: false +diff --git a/yarn.lock b/yarn.lock +--- a/yarn.lock ++++ b/yarn.lock +@@ -2,6 +2,6 @@ + # Manual changes might be lost - proceed with caution! + + __metadata: +- version: 8 ++ version: 9 + cacheKey: 10 +