From d67c1a4c6b0852bad6b361555f3b0522bb10cb36 Mon Sep 17 00:00:00 2001 From: hacker1024 Date: Wed, 8 May 2024 19:24:51 +1000 Subject: [PATCH] pub2nix.generatePackageConfig: Use logical paths for pubspec.yaml --- pkgs/build-support/dart/pub2nix/package-config.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/dart/pub2nix/package-config.nix b/pkgs/build-support/dart/pub2nix/package-config.nix index 70abb0a76cef..85f69ec8f071 100644 --- a/pkgs/build-support/dart/pub2nix/package-config.nix +++ b/pkgs/build-support/dart/pub2nix/package-config.nix @@ -34,13 +34,15 @@ in done < <(jq -r '.packages | to_entries | map("\(.key),\(.value.src),\(.value.packageRoot)") | .[]' "$NIX_ATTRS_JSON_FILE") for package in "''${!packageSources[@]}"; do - if [ ! -e "''${packageSources["$package"]}/''${packageRoots["$package"]}/pubspec.yaml" ]; then + pubspec="$(realpath --logical "''${packageSources["$package"]}/''${packageRoots["$package"]}/pubspec.yaml")" + + if [ ! -e "$pubspec" ]; then echo >&2 "The package sources for $package are missing. Is the following path inside the source derivation?" - echo >&2 "Source path: ''${packageSources["$package"]}/''${packageRoots["$package"]}/pubspec.yaml" + echo >&2 "Source path: $pubspec" exit 1 fi - languageConstraint="$(yq -r .environment.sdk "''${packageSources["$package"]}/''${packageRoots["$package"]}/pubspec.yaml")" + languageConstraint="$(yq -r .environment.sdk "$pubspec")" if [[ "$languageConstraint" =~ ^[[:space:]]*(\^|>=|>)?[[:space:]]*([[:digit:]]+\.[[:digit:]]+)\.[[:digit:]]+.*$ ]]; then languageVersionJson="\"''${BASH_REMATCH[2]}\"" elif [ "$languageConstraint" = 'any' ]; then