Skip to content

Fix nix Github workflow #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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