Nix for CI/CD pipelines?

I have looked around but not found anything conclusive: is there a way to define CI/CD pipelines using Nix? I currently have Nix managing my project dependencies, managing development environments, building OCI containers, etc. I still use GitLab CI and GitHub Actions YAML for the actual pipeline steps. Is there a way to use Nix to manage that as well?

In theory, you can use nix to either built the YAMLs needed from a nix expression or you can use nix to return data that is equivalent to the YAML data you want, and render that through nix-instantiate --json into something you can either use as is or remarshal into “proper” YAML.

Though as GHA and GLCI only understand YAML you will always end up in a updating problem and you need to ensure that the nix-sources and the YAML in the repo are consistent.

I played with it about a year ago and got annoyed by the synchronisation overhead and dropped the idea.

3 Likes

Consider checking out GitHub - DevPalace/phoenix-ci

2 Likes