Skip to content

Commit 9ff0192

Browse files
authored
Merge pull request #444 from ngi-nix/fix-nix-workflow
Fix nix Github workflow
2 parents 8aafb63 + 2da0c14 commit 9ff0192

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.github/workflows/test-import-using-nix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ jobs:
2525
- name: run checks & test import
2626
run: |
2727
cd etc/nix
28+
./get-latest-pypi-deps-db.sh --in-place
2829
nix --print-build-logs flake check
2930
./test-import-using-nix.sh alpine

etc/nix/get-latest-pypi-deps-db.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ COMMIT=$(sed '1q;d' <<< "$DATA")
77
DATE=$(sed '2q;d' <<< "$DATA")
88
SHA256=$(nix-prefetch-url --unpack --type sha256 "https://github.com/$USER_SLASH_REPO/tarball/$COMMIT" | tail -n 1)
99

10+
NIX_REV_ATTR="pypiDataRev = \"$COMMIT\"; # $DATE"
11+
NIX_SHA_ATTR="pypiDataSha256 = \"$SHA256\";"
12+
1013
echo ""
11-
echo "pypiDataRev = \"$COMMIT\"; # $DATE"
12-
echo "pypiDataSha256 = \"$SHA256\";"
14+
echo $NIX_REV_ATTR
15+
echo $NIX_SHA_ATTR
16+
17+
if [[ "$1" = "--in-place" ]] ; then
18+
# Replace the values in the flake.
19+
PATTERN="\s*\n?\s*\"[^\n]+" # <space><newline><space>"content...<newline>
20+
perl -i.bak1 -0777 -pe "s/pypiDataRev =$PATTERN/$NIX_REV_ATTR/" flake.nix
21+
perl -i.bak2 -0777 -pe "s/pypiDataSha256 =$PATTERN/$NIX_SHA_ATTR/" flake.nix
22+
fi

0 commit comments

Comments
 (0)