This works around GitHub's limit on the number of matrix jobs (fixes #947), by running all builds in a single job. To maintain some speed, we use `nix-fast-build`, which uses multiple cores for evaluation, and skips any builds for which the final derivation is already in a binary cache. Although this makes the run for an individual pull request slower, the amount of duplicated work is greatly reduced: previously, we often had 100 machines building the same derivation in parallel. This means that more runners are available should there be multiple pull requests opened in a short space of time, so there is less queuing. It's also more energy efficient. A potential downside is that the logs are all merged together, so it can be hard to find what failed when lots of outputs were built. `nix-fast-build` does report a list of failed attributes at the end of the log, but this is currently broken: https://github.com/Mic92/nix-fast-build/pull/98 The script used to launch `nix-fast-build` is also added to the developer shell for local use. This replaces the old `nix-flake-check` package (closes #898). I also saw the opportunity to enable checks on `aarch64-linux` and `aarch64-darwin` - as these are available as GitHub hosted runners.
1.8 KiB
Development environment
Developer shell
To enter the developer shell, run:
nix develop
To automatically enter the developer shell upon entering the project directory
with direnv, run:
direnv allow
pre-commit
The default developer shell leverages pre-commit
hooks to simplify the process of reaching minimum quality standards for casual
contributors. This means applying code formatters, and scanning for things like
unused variables which should be removed.
By default, once you have entered the developer shell, pre-commit runs
automatically just before you create a commit. This will only look at the
files which are about to be committed.
You can also run it manually against all files:
pre-commit run --all-files
This is useful if a commit was created outside of the developer shell, and
you need to apply pre-commit to your previous changes.
Note that there is also a flake output, .#checks.«system».git-hooks, which
always runs against all files but does not have access to apply changes. This
is used in GitHub Actions to ensure that pre-commit has been applied.
stylix-check
When a pull request is opened, we use GitHub Actions to build everything under
.#checks. This includes the previously mentioned .#checks.«system».git-hooks,
and every testbed.
You might sometimes find it useful to run these same checks locally. The built
in nix flake check command does this, however it can be quite slow compared
to the script we use on GitHub Actions.
To use the same script that we use, you can run this command within the developer shell:
stylix-check
This is based on nix-fast-build.