Skip to content
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

Automatically fix the nix hash #1600

Merged
merged 29 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 13 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
17 changes: 16 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: cachix/install-nix-action@v24
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}

- name: "Building the nix file"
run: |
echo "If the job is failing with: \"hash mismatch in fixed-output derivation\""
echo "Copy the hash after \"got:\" and replace \"npmDepsHash\" in \"flake-module.nix\" with the hash"
! nix develop --command "exit 1" 2>&1 | grep "hash mismatch" -A2
! nix develop --command "exit 1" 2>shell_output

# Filter the hash and then replace it in `flake-module.nix`
# This needs to run before the last step that may let's the job fail
cat shell_output | grep "got:" | sed "s/[ \t]*got:[ \t]*//" > hash
sed "s@npmDepsHash = \"[^\"]*\"@npmDepsHash = \"$(cat hash)\"@" -i flake-module.nix

! cat shell_output | grep "hash mismatch" -A2

- uses: stefanzweifel/git-auto-commit-action@v5
if: always()
with:
add_options: '-u'
commit_message: Fix nix hash
2 changes: 1 addition & 1 deletion flake-module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
...
}: let
# this change on each change of dependencies, unfortunately this hash not yet automatically updated from SRI of package.lock
npmDepsHash = "sha256-Nhbhe4R7NHN5E/emJlLLjbVRrvqwfO3I32Pg5La35AI=";
npmDepsHash = "sha256-CkQ9b8fWzuWkZoH+I+8htqaTjMHSXa8LPWltoU75/8Q=";
####

# there is officia polkadot on nixpkgs, but it has no local rococo wasm to run
Expand Down