Nix FMS stack builds

MG

Nix builds and env for a microservice stack.

Development and setup of components for builds of a microservices stack written primarily in Rust, leveraging Nix for environment setup and build automation, and GitLab CI for build/test pipelines.

Highlights

  • modular and reusable CI/CD pipeline definitions
  • Nix for environment setup and builds

Details

A Nix flake was developed that included package definitions for all of the services and other dependencies, a pseudo-package that used 3rd-party tools like Helm and Nickel to generate deployment manifests, as well as checks that could all be executed with nix build. The outputs also included a dev shell containing all the external dependencies and internal tools needed during local development.

CD/CD pipeline definitions were then developed:

  • using GitLab CI's includes in order to split reusable environment setup templates into separate files in a common CI project
  • using stages for checks, builds, and tests
  • using defined Nix flake outputs executed using nix build .#output which allowed for seamless reuse between local dev environment and CI pipelines

Skills & Technologies