4 ms·
There is an extra superpower here that isn't mentioned - you can then trivially turn this into a CI job. This is a valid complete .gitlab-ci.yml file for the se
by rkangel 4y ago
There is an extra superpower here that isn't mentioned - you can then trivially turn this into a CI job. This is a valid complete .gitlab-ci.yml file for the setup in this blog post:
image: nixos/nix:latest
before_script:
- nix-env -f shell.nix -i -A buildInputs
full_build:
stage: build
script:
- dune build
This uses a standard docker container with Nix built in. The before_script magic then installs everything into that container exactly as it is in your development environment. Subsequent commands then run exactly as in your environment.
Of course with this approach, every CI job builds your whole environment. If this complex, and involves many compilation steps, then that is painful and you will instead want to use the nix setup to build a docker image that is used for your CI. For many projects involving small teams, that isn't necessary though and this works really well.