|
| 1 | +# Stdlib CI |
| 2 | + |
| 3 | +The CI is mostly implemented using Nix on top of packages of the |
| 4 | +nixpkgs repository https://github.com/NixOS/nixpkgs through the |
| 5 | +coq-nix-toolbox https://github.com/coq-community/coq-nix-toolbox . |
| 6 | +Binary results are cached using Cachix. |
| 7 | + |
| 8 | +### Local Installation and Nix Usage |
| 9 | + |
| 10 | +See this wiki page |
| 11 | +https://github.com/math-comp/math-comp/wiki/Using-nix for how to |
| 12 | +install and setup Nix and Cachix. |
| 13 | + |
| 14 | +### Rerunning a CI Task Locally |
| 15 | + |
| 16 | +You can take example of the files `.github/workflows/nix-action-coq-*.yml` |
| 17 | +For instance, to rerun iris for Coq master : |
| 18 | +```shell |
| 19 | +% nix-build --argstr bundle "coq-master" --argstr job iris |
| 20 | +``` |
| 21 | +The list of bundles can be found in `.nix/config.nix`. |
| 22 | + |
| 23 | +### Test CI Configurations with Overlays |
| 24 | + |
| 25 | +For simple overlays, it's enough to add a line in the .nix/config.nix |
| 26 | +file (look for "overlay" there). |
| 27 | + |
| 28 | +For more elaborate overlays (for instance editing package dependencies |
| 29 | +or build process), a simple way to test modifications of the CI |
| 30 | +configuration (new version or configuration change of some package for |
| 31 | +instance) is through overlays, see the corresponding paragraph at |
| 32 | +https://github.com/coq-community/coq-nix-toolbox#overlays (for sha256 |
| 33 | +hashes, one can just put an empty string, run the `nix-build` command |
| 34 | +above and an error will give the correct value). |
| 35 | + |
| 36 | +### Updating coq-nix-toolbox |
| 37 | + |
| 38 | +Once overlays are satisfactory, they should eventually be merged into |
| 39 | +the nixpkgs package repository. |
| 40 | + |
| 41 | +The file `.nix/coq-nix-toolbox.nix` contains the git commit hash of |
| 42 | +the version of coq-nix-toolbox used (c.f., |
| 43 | +https://github.com/coq-community/coq-nix-toolbox ). Coq-nix-toolbox |
| 44 | +itself contains the git commit hash of the version of nixpkgs it uses |
| 45 | +(c.f. https://github.com/NixOS/nixpkgs/ ). So in order to add or |
| 46 | +remove a Nix derivation (package), one needs to first update nixpkgs, |
| 47 | +then coq-nix-toolbox and finally the `.nix/coq-nix-toolbox.nix` file |
| 48 | +here. See the [coq-nix-toolbox README](https://github.com/coq-community/coq-nix-toolbox#testing-coqpackages-updates-in-nixpkgs) |
| 49 | +for details of the process. |
| 50 | + |
| 51 | +The most common maintenance action on the CI is currently to update |
| 52 | +the version of the coq-nix-toolbox and regenerate the github action |
| 53 | +workflows, see the last command of [this |
| 54 | +paragraph](https://github.com/coq-community/coq-nix-toolbox?tab=readme-ov-file#standalone). |
| 55 | + |
| 56 | +### Learning Nix basics |
| 57 | + |
| 58 | +Basic concepts of the Nix package manager: |
| 59 | +https://nixos.org/manual/nix/stable/ (I particularly recommend |
| 60 | +[Part I. introduction](https://nixos.org/manual/nix/stable/#chap-introduction) and |
| 61 | +[Chapter 9. Basic Package Management](https://nixos.org/manual/nix/stable/#ch-basic-package-mgmt)) |
| 62 | + |
| 63 | +Nix is based on its own functional language: |
| 64 | +[Part IV. Writing Nix Expressions](https://nixos.org/manual/nix/stable/#chap-writing-nix-expressions) |
| 65 | + |
| 66 | +Specifics for Coq packages: [15.5. Coq and coq packages](https://nixos.org/manual/nixpkgs/unstable/#sec-language-coq) |
| 67 | + |
| 68 | +### Caching |
| 69 | + |
| 70 | +The CI uses caching provided by https://www.cachix.org/ and there is a |
| 71 | +token in the coq-community organization to authenticate and store the |
| 72 | +results. Any CI build is stored globally and can be used on one's own |
| 73 | +computer as described in |
| 74 | +https://github.com/math-comp/math-comp/wiki/Using-nix |
| 75 | + |
| 76 | +### Specific CI jobs |
| 77 | + |
| 78 | +#### stdlib-subcomponents |
| 79 | + |
| 80 | +Checks that the dependencies between stdlib subcomponents (as |
| 81 | +documented in [doc/stdlib/index.html](../../doc/stdlib/index.html)) is |
| 82 | +not broken. |
| 83 | + |
| 84 | +#### Other non-Nix jobs |
| 85 | + |
| 86 | +##### basic-checks |
| 87 | + |
| 88 | +Checks that the theories/Make.all and other theories/Make.* files are |
| 89 | +consistent. Also checks that no two sources files in the stdlib (+ Coq |
| 90 | +prelude) have the same name (which could lead to conflict when doing |
| 91 | +`From Stdlib Require File.`). |
| 92 | + |
0 commit comments