From 91b3db13093b1aecdba07041eb44b7103c235d94 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Sat, 9 Mar 2024 01:04:40 +0800 Subject: treewide: fix sourceRoot for fetchgit-based src According to Nixpkgs manual[1] and NixOS 23.11 Release Note[2], the `sourceRoot` attribute passed to `stdenv.mkDerivation` should be specified as `"${src.name}"` or `"${src.name}/subdir"` when `src` is produced using `fetchgit`-based fetchers. `sourceRoot = "source"` or `sourceRoot = "source/subdir"` is based on the assumption that the `name` attribute of these pre-unpacked fetchers are always `"source"`, which is not the case. Expecting constant `name` also makes the source FODs prone to irrelevent hashes during version bumps. [1]: https://nixos.org/manual/nixpkgs/unstable/#var-stdenv-sourceRoot [2]: https://nixos.org/manual/nixos/stable/release-notes#sec-release-23.11 --- pkgs/development/tools/electron/common.nix | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'pkgs/development/tools/electron') diff --git a/pkgs/development/tools/electron/common.nix b/pkgs/development/tools/electron/common.nix index 823b45971139f..4cfb464078ffe 100644 --- a/pkgs/development/tools/electron/common.nix +++ b/pkgs/development/tools/electron/common.nix @@ -34,9 +34,11 @@ in (chromium.override { upstream-info = info.chromium; }).mkDerivation (base: { yarnLock = (fetchdep info.deps."src/electron") + "/yarn.lock"; sha256 = info.electron_yarn_hash; }; - npmDeps = fetchNpmDeps { + npmDeps = fetchNpmDeps rec { src = fetchdep info.deps."src"; - sourceRoot = "source/third_party/node"; + # Assume that the fetcher always unpack the source, + # based on update.py + sourceRoot = "${src.name}/third_party/node"; hash = info.chromium_npm_hash; }; -- cgit 1.4.1