Skip to content

Add support for static nix-tools #31

Add support for static nix-tools

Add support for static nix-tools #31

name: Wait for Hydra Build
on:
push:
branches:
- main
tags:
- "nix-tools-*"
pull_request:
env:
FLAKE_REF: github:${{ github.repository }}?ref=${{ github.head_ref || github.ref }}
GH_TOKEN: ${{ github.token }}
jobs:
wait-for-hydra:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix with good defaults
uses: input-output-hk/install-nix-action@v20
with:
extra_nix_config: |
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=
substituters = https://cache.nixos.org/ https://cache.iog.io/ https://cache.zw3rk.com
nix_path: nixpkgs=channel:nixos-unstable
- name: Display flake metadata
id: flake-metadata
run: |
echo $PWD
ls -lah .
nix flake metadata ${{ env.FLAKE_REF }}
nix flake metadata ${{ env.FLAKE_REF }} --json | jq -r '"LOCKED_URL=\(.url)"' >> "$GITHUB_OUTPUT"
- name: Wait for nix-tools meta job
uses: input-output-hk/actions/wait-for-hydra@angerman/support-prs
with:
status: 'ci/hydra-build:nix-tools'
- name: "Pull nix-tools"
run: |
ls -lah .
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.aarch64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip .
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-darwin.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip .
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-no-ifd --no-link --print-out-paths)/*.zip .
cp $(nix build --builders "" --max-jobs 0 ${{ steps.flake-metadata.outputs.LOCKED_URL }}#hydraJobs.x86_64-linux.nix-tools.static.zipped.nix-tools-static-arm64-no-ifd --no-link --print-out-paths)/*.zip .
- name: Configure Git
if: startsWith(github.ref, 'refs/tags/')
run: |
git config --global user.name 'Auto Update Bot'
git config --global user.email 'no-reply@iohk.io'
- name: "Compute nix-tools-static.nix"
if: startsWith(github.ref, 'refs/tags/')
run: |
git fetch --all
git switch --force static-nix-tools
(
echo "pkgs: let baseurl = \"https://github.com/input-output-hk/haskell.nix/releases/download/${GITHUB_REF_NAME}/\"; in {"
for arch in aarch64-darwin x86_64-darwin aarch64-linux x86_64-linux; do
echo " ${arch} = pkgs.fetchurl { "
echo " name = \"${arch}-nix-tools-static\";"
echo " url = \"\${baseurl}${arch}-nix-tools-static.zip\";"
echo " sha256 = \"$(nix-hash --sri --type sha256 --flat ${arch}-nix-tools-static.zip)\";"
echo " };"
done
echo "}"
) > nix-tools-static.nix
cat nix-tools-static.nix
- name: Push to nix branch
if: startsWith(github.ref, 'refs/tags/')
run: |
git add nix-tools-static.nix
git commit -m "update nix-tools-static.nix"
git push origin static-nix-tools
- name: Release
uses: input-output-hk/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*-nix-tools-static.zip