Skip to content

Commit

Permalink
Merge pull request aboutcode-org#444 from ngi-nix/fix-nix-workflow
Browse files Browse the repository at this point in the history
Fix nix Github workflow
  • Loading branch information
sbs2001 authored Apr 19, 2021
2 parents 8aafb63 + 2da0c14 commit 9ff0192
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-import-using-nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
- name: run checks & test import
run: |
cd etc/nix
./get-latest-pypi-deps-db.sh --in-place
nix --print-build-logs flake check
./test-import-using-nix.sh alpine
14 changes: 12 additions & 2 deletions etc/nix/get-latest-pypi-deps-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ COMMIT=$(sed '1q;d' <<< "$DATA")
DATE=$(sed '2q;d' <<< "$DATA")
SHA256=$(nix-prefetch-url --unpack --type sha256 "https://github.com/$USER_SLASH_REPO/tarball/$COMMIT" | tail -n 1)

NIX_REV_ATTR="pypiDataRev = \"$COMMIT\"; # $DATE"
NIX_SHA_ATTR="pypiDataSha256 = \"$SHA256\";"

echo ""
echo "pypiDataRev = \"$COMMIT\"; # $DATE"
echo "pypiDataSha256 = \"$SHA256\";"
echo $NIX_REV_ATTR
echo $NIX_SHA_ATTR

if [[ "$1" = "--in-place" ]] ; then
# Replace the values in the flake.
PATTERN="\s*\n?\s*\"[^\n]+" # <space><newline><space>"content...<newline>
perl -i.bak1 -0777 -pe "s/pypiDataRev =$PATTERN/$NIX_REV_ATTR/" flake.nix
perl -i.bak2 -0777 -pe "s/pypiDataSha256 =$PATTERN/$NIX_SHA_ATTR/" flake.nix
fi

0 comments on commit 9ff0192

Please sign in to comment.