From 38e20a3242a8dbd50d1c7d2dc060232edb7d907f Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 24 Apr 2021 03:42:01 +0200 Subject: common-updater-scripts: Replace flake source by local path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When update-source-version is run in a repo with flake-compat, it would find the files in Nix store. Let’s replace them with the local path of the repository. --- pkgs/common-updater/scripts/update-source-version | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pkgs/common-updater') diff --git a/pkgs/common-updater/scripts/update-source-version b/pkgs/common-updater/scripts/update-source-version index 0c914ebee2c..15792e1502e 100755 --- a/pkgs/common-updater/scripts/update-source-version +++ b/pkgs/common-updater/scripts/update-source-version @@ -83,6 +83,14 @@ if [[ -z "$nixFile" ]]; then if [[ ! -f "$nixFile" ]]; then die "Couldn't evaluate '$attr.meta.position' to locate the .nix file!" fi + + # flake-compat will return paths in the Nix store, we need to correct for that. + possiblyOutPath=$(nix-instantiate $systemArg --eval -E "with $importTree; outPath" | tr -d '"') + if [[ -n "$possiblyOutPath" ]]; then + outPathEscaped=$(echo "$possiblyOutPath" | sed 's#[$^*\\.[|]#\\&#g') + pwdEscaped=$(echo "$PWD" | sed 's#[$^*\\.[|]#\\&#g') + nixFile=$(echo "$nixFile" | sed "s|^$outPathEscaped|$pwdEscaped|") + fi fi oldHashAlgo=$(nix-instantiate $systemArg --eval --strict -A "$attr.src.drvAttrs.outputHashAlgo" | tr -d '"') -- cgit 1.4.1