Continuous Integration (CI): Difference between revisions
imported>Mic92 fix syntax |
m Drop banned user's contribution |
||
(17 intermediate revisions by 8 users not shown) | |||
Line 23: | Line 23: | ||
See [https://github.com/cachix/install-nix-action install-nix-action] to install nix in Linux/macOS actions. | See [https://github.com/cachix/install-nix-action install-nix-action] to install nix in Linux/macOS actions. | ||
There is also [https://github.com/cachix/cachix-action one action] to setup [https://cachix.org/ cachix], a hosted binary cache. | There is also [https://github.com/cachix/cachix-action one action] to setup [https://cachix.org/ cachix], a hosted binary cache. | ||
==== Self-hosted runners ==== | |||
NixOS has a module for running self-hosted GitHub runners. | |||
=== Build kite === | === Build kite === | ||
NixOS | See the [[Buildkite]] article | ||
=== Drone === | |||
There is no official NixOS module however both drone and drone-cli are packaged in nixpkgs. | |||
Mic92 has the following [https://github.com/Mic92/dotfiles/blob/master/nixos/eve/modules/drone/ custom module] in his repository. An example public project can be found in [https://github.com/Mic92/cntr/blob/e1b58463d55567bd795d1f3cfb4c6784f57c895a/.drone.yml cntr] and this project for an example using flakes [https://github.com/Mic92/dotfiles/blob/05daca459d96557eeeb72196258e6bffc73c1360/.drone.yml Mic92's dotfiles]. | |||
=== Jenkins === | |||
[[Jenkins]] | |||
=== Gitlab === | |||
NixOS has a module for [[Gitlab runner]] | |||
=== Garnix === | |||
[https://garnix.io/ Garnix] is a nix-specific CI provider that also provides a cache. it currently only works with flake-enabled repos. | |||
=== Sourcehut === | |||
[https://sourcehut.org Sourcehut] provides [https://man.sr.ht/builds.sr.ht/compatibility.md#nixos an official NixOS image] | |||
[ | [[Category:Server]] | ||
[[Category:Applications]] |
Latest revision as of 23:22, 22 May 2024
Nix nicely integrates into your CI.
TODO: some general tips & tricks
Avoid downloading already built results
nix-build
will always ensure the built store path is put in the local store, be it by building or by downloading from a substituter. On CI, we often only want to check whether we can build the derivation, without using or running the output.
This can be achieved by using `--dry-run` to check whether the result would be fetched, and only building it it has to be built.
nix-build-if-changed.py implements this in a relatively straightforward (but naïve) Python script.
nix-build-uncached implements it in a slightly more elaborate manner, and is available on nixpkgs (as the nix-build-uncached
package).
Instructions for specific CI Providers
Travis CI
See Nix_on_Travis article
Github actions
See install-nix-action to install nix in Linux/macOS actions. There is also one action to setup cachix, a hosted binary cache.
Self-hosted runners
NixOS has a module for running self-hosted GitHub runners.
Build kite
See the Buildkite article
Drone
There is no official NixOS module however both drone and drone-cli are packaged in nixpkgs.
Mic92 has the following custom module in his repository. An example public project can be found in cntr and this project for an example using flakes Mic92's dotfiles.
Jenkins
Gitlab
NixOS has a module for Gitlab runner
Garnix
Garnix is a nix-specific CI provider that also provides a cache. it currently only works with flake-enabled repos.
Sourcehut
Sourcehut provides an official NixOS image