Skip to content

flake: add cachix public key to nixConfig. #714

flake: add cachix public key to nixConfig.

flake: add cachix public key to nixConfig. #714

Workflow file for this run

name: rebuilds
on: [pull_request]
jobs:
# Calculate changed derivations
get-changed-derivs:
name: Get changed derivations
runs-on: ubuntu-latest
steps:
# Install Nix on the runner
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
# Pull from the cachix cache
- uses: cachix/cachix-action@v15
with:
name: nix-qchem
# Checkout of the current head in the working dir
- uses: actions/checkout@v4
# Get PR target branch checkout
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}
repository: ${{ github.event.pull_request.base.repo.full_name }}
path: pr_base
# Get a checkout of this PR
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
path: pr_head
- name: Calculate changed derivations and upload as artifacts
run: nix eval --impure --expr 'import ./.github/workflows/changedPaths.nix ./pr_head ./pr_base' --json | tee chDerivs.json
# Upload JSON of the changed derivations
- uses: actions/upload-artifact@v4
with:
name: Changed-Derivations-${{ github.event.number }}
path: chDerivs.json
retention-days: 1
# Rebuild changed derivations for the pinned snapshot
rebuild-head:
name: Changed derivations HEAD (pinned nixpkgs)
needs: get-changed-derivs
runs-on: ubuntu-latest
steps:
# Install Nix on the runner
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v6
# Pull from the cachix cache
- uses: cachix/cachix-action@v15
with:
name: nix-qchem
# Checkout of the current head in the working dir
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
# Get changed derivations as artifact from previous step
- uses: actions/download-artifact@v4
with:
name: Changed-Derivations-${{ github.event.number }}
- name: Rebuild python3 packages
run: |
if [ -n "$(jq '.python3[]' chDerivs.json)" ]; then
nix build --extra-substituters https://nix-qchem.cachix.org --print-build-logs -f release.nix $(for p in $(jq '.python3[]' chDerivs.json | tr -d "\""); do echo "qchem.python3.${p}"; done)
fi
- name: Rebuild all top-level packages
run: |
if [ -n "$(jq '.topLevel[]' chDerivs.json)" ]; then
nix build --extra-substituters https://nix-qchem.cachix.org --print-build-logs -f release.nix $(for p in $(jq 'del(.topLevel[] | select(. == "release-barrier")) | .topLevel[]' chDerivs.json | tr -d "\""); do echo "qchem.${p}"; done)
fi
# Rebuild changed derivations as if merged
rebuild-merge:
name: Changed Derivations Merge (pinned nixpkgs)
needs: get-changed-derivs
runs-on: ubuntu-latest
steps:
# Install Nix on the runner
- uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v6
# Pull from the cachix cache
- uses: cachix/cachix-action@v15
with:
name: nix-qchem
# Checkout merge commit as if PR would already be merged
- uses: actions/checkout@v4
# Get changed derivations as artifact from previous step
- uses: actions/download-artifact@v4
with:
name: Changed-Derivations-${{ github.event.number }}
- name: Rebuild all changed python3 packages
run: |
if [ -n "$(jq '.python3[]' chDerivs.json)" ]; then
nix build --extra-substituters https://nix-qchem.cachix.org --print-build-logs -f release.nix $(for p in $(jq '.python3[]' chDerivs.json | tr -d "\""); do echo "qchem.python3.${p}"; done)
fi
- name: Rebuild all changed top-level packages
run: |
if [ -n "$(jq '.topLevel[]' chDerivs.json)" ]; then
nix build --extra-substituters https://nix-qchem.cachix.org --print-build-logs -f release.nix $(for p in $(jq 'del(.topLevel[] | select(. == "release-barrier")) | .topLevel[]' chDerivs.json | tr -d "\""); do echo "qchem.${p}"; done)
fi