Files
nixfiles/.gitea/workflows/ci.yaml
T
jackos1998 fabbb43fbf
Update docs / update (push) Successful in 1m5s
CI / Check, build and cache nixfiles (push) Failing after 1h2m10s
ci/nix: Allow IFD for runtime dependency replacements
Share a single replacement list between NixOS and standalone Home
Manager. CI checks that list against its targets' nixpkgs channels.

When a replacement applies, warn and defer the flake check until
after the target builds. Runtime replacement needs to generate and
import store reference graphs during evaluation, which fails under
`nix flake check --no-build` on a fresh runner.

Keep the early eval-only check and disable IFD when the list is empty.
2026-11-23 23:45:23 +00:00

78 lines
2.8 KiB
YAML

name: CI
on:
push:
branches: [master]
jobs:
check:
name: Check, build and cache nixfiles
runs-on: ubuntu-26.04
steps:
- uses: actions/checkout@v6
- uses: DeterminateSystems/determinate-nix-action@v3
with:
# Gitea will supply a token in GITHUB_TOKEN, which this action passes to
# Nix (as access-tokens) when downloading from GitHub
github-token: ${{ secrets.GH_PULL_TOKEN }}
extra-conf: |
# Make sure we're using sandbox
sandbox-fallback = false
# Big C++ projects fill up memory...
cores = 6
# Determinate performance features
lazy-trees = true
eval-cores = 0
accept-flake-config = true
extra-substituters = https://nix-cache.nul.ie
extra-trusted-public-keys = nix-cache.nul.ie-1:BzH5yMfF4HbzY1C977XzOxoPhEc9Zbu39ftPkUbH+m4=
- name: Check flake
id: ifd
run: |
reasons="$(nix eval --option allow-import-from-derivation false --json .#ciIfdReasons.x86_64-linux)"
required="$(jq -r 'length > 0' <<< "$reasons")"
echo "required=$required" >> "$GITHUB_OUTPUT"
if [[ "$required" == true ]]; then
jq -r '.[] | "::warning::\(.). The flake check will run after the target builds."' <<< "$reasons"
else
nix flake check --no-build --option allow-import-from-derivation false
fi
- name: Build (and cache) the world
id: build
env:
HARMONIA_SSH_KEY: ${{ secrets.HARMONIA_SSH_KEY }}
CI_IFD_REQUIRED: ${{ steps.ifd.outputs.required }}
run: |
set -o pipefail
nix_options=(--option allow-import-from-derivation "$CI_IFD_REQUIRED")
echo "::group::Collect cache garbage"
ci/push-to-cache.sh --gc
echo "::endgroup::"
nix eval "${nix_options[@]}" --json --apply "builtins.attrNames" .#ci.x86_64-linux | jq -cr '.[]' | while read job; do
echo "::group::Build $job"
nix build "${nix_options[@]}" --no-link .#ci.x86_64-linux."$job"
echo "::endgroup::"
echo "::group::Cache $job"
ci/push-to-cache.sh "$(nix eval "${nix_options[@]}" --raw .#ci.x86_64-linux."$job")"
echo "::endgroup::"
done
if [[ "$CI_IFD_REQUIRED" == true ]]; then
echo "::group::Check flake"
# The target closures are available for the evaluation-time reference graphs.
nix flake check "${nix_options[@]}"
echo "::endgroup::"
fi
echo "Building and caching CI derivation"
nix build "${nix_options[@]}" --no-link .#ciDrv.x86_64-linux
UPDATE_PROFILE=1 ci/push-to-cache.sh "$(nix eval "${nix_options[@]}" --raw .#ciDrv.x86_64-linux)"