Skip to content

Fix: Enable flake validation by default even when imports are used

Horizon Bot requested to merge investigate-canary-flake-jobs into master

Problem

Flake validation was not enabled by default when users used gitlab.ci.imports to add custom modules. The default modules = [flake] was being overridden by imported modules that set config.modules.

Example that didn't show flake validation jobs:

gitlab.ci = {
  enable = true;
  imports = [ inputs.gitlab-ci.modules.gitlab-ci.canaries ];
  canaries.enable = true;
}

Root Cause

When gitlab-ci modules (like canaries, omnix, etc.) set config.modules = [{stages = ...; jobs = ...}], this overrode the default modules = [flake] because the module's definition had higher priority than the default.

Solution

Add the flake module to the base submoduleWith.modules list instead of as a default on the modules option. Modules in the base list are ALWAYS part of the submodule evaluation, regardless of what users add via imports or the modules option.

This matches how flake-parts handles always-included modules.

Changes

  • Add flake module to submoduleWith.modules base list in gitlab-ci.nix:79-82
  • Remove redundant default from modules option (now empty list)
  • Update modules option description to clarify automatic inclusion
  • Add test: it-enables-flake-validation-by-default to verify the fix

Testing

Main gitlab-ci shows flake validation jobs Canary test now shows flake validation jobs + canary job
New test shows flake validation jobs + custom job All existing tests pass

This fulfills the 0.18.0 ChangeLog promise: "Flake validation is now enabled by default when `gitlab.ci.enable = true`"

🤖 Generated with Claude Code

Merge request reports