Skip to content

feat(flakeModules): terraform/ansible/python profile modules#34

Merged
JacobPEvans-personal merged 1 commit into
mainfrom
feat/precommit-profiles
May 31, 2026
Merged

feat(flakeModules): terraform/ansible/python profile modules#34
JacobPEvans-personal merged 1 commit into
mainfrom
feat/precommit-profiles

Conversation

@JacobPEvans-personal
Copy link
Copy Markdown
Member

Summary

  • Adds flakeModules.{terraform,ansible,python} profile modules — each composes dev-hygiene (base wiring) with a small set of language-specific git-hooks.nix hooks. Consumers pick one import:

    imports = [ inputs.nix-devenv.flakeModules.terraform ];
  • Exposes flakeModules.{base,nix,markdown} as aliases for dev-hygiene. The base wiring already covers nix lints (deadnix/statix) and markdownlint-cli2; file-glob filtering makes them inert when matching files are absent, so a base profile is correct for those ecosystems.

  • Adds tests/profile-modules/<profile>/ validator flakes — one per profile, each nix flake check-able. They exercise the full hook chain and lock the git-hooks.nix attribute names against future drift. The terraform validator caught the underscore-vs-hyphen drift (terraform-format, terraform-validate) before this PR shipped.

Hooks enabled per profile (on top of base)

Profile Adds
terraform terraform-format, terraform-validate, tflint
ansible ansible-lint, yamllint
python ruff, ruff-format, mypy

checkov (3 inventory repos), bandit / detect-secrets (1 each) stay opt-in per repo to keep the profile fast — consumers enable them locally.

Architecture context

This is Phase 1a of the shared pre-commit rollout. Phase 1b lands the canonical shared lint configs (.markdownlint, .tflint.hcl, .ansible-lint, .yamllint.yml) in dryvist/.github/precommit/configs/. After Phase 1b lands, a follow-up to this work wires lib.fetch-shared-configs.nix so the profiles pass --config <nix-store-path> and consumer repos can delete their copies. Phase 2 migrates 16+ Nix-flake repos to a one-line imports = [ ... ].

Background and full plan: the architecture was decided in the user's planning session — dryvist/.github is the single canonical home for shared configs (Biome / markdownlint precedent), nix-devenv is the canonical home for the Nix-side hook module.

Test plan

  • CI green
  • cd tests/profile-modules/terraform && nix flake check succeeds locally (verified)
  • cd tests/profile-modules/ansible && nix flake check succeeds locally (verified)
  • cd tests/profile-modules/python && nix flake check succeeds locally (verified)
  • Adopt flakeModules.terraform in terraform-runs-on as a Phase 2 trial migration (separate PR)

Assisted-by: Claude noreply@anthropic.com

Each profile composes flakeModules.dev-hygiene with a small set of
language-specific git-hooks.nix hooks so a consumer picks one import:

  imports = [ inputs.nix-devenv.flakeModules.terraform ];

Hooks enabled on top of base hygiene:

  terraform - terraform-format, terraform-validate, tflint
  ansible   - ansible-lint, yamllint
  python    - ruff, ruff-format, mypy

base / nix / markdown are exposed as aliases for dev-hygiene because the
base wiring already covers nix lints (deadnix/statix) and markdownlint
via file-glob-filtered hooks - those run inertly when matching files are
absent, so a single base profile is correct for those ecosystems.

tests/profile-modules/<profile>/ houses one validator flake per profile.
Running `nix flake check` in each exercises the full hook chain end-to-
end; the terraform validator caught the underscore-vs-hyphen drift in
git-hooks.nix hook names (terraform-format, terraform-validate) before
the profile shipped to any consumer repo, and locks the names against
future drift.

Refs: shared pre-commit architecture rollout, Phase 1a.

Assisted-by: Claude <noreply@anthropic.com>
@JacobPEvans-personal JacobPEvans-personal merged commit 9896590 into main May 31, 2026
1 check passed
@JacobPEvans-personal JacobPEvans-personal deleted the feat/precommit-profiles branch May 31, 2026 02:53
JacobPEvans-personal added a commit to dryvist/docs that referenced this pull request May 31, 2026
* docs(conventions): pre-commit architecture page

Document the shared pre-commit architecture as a public-facing
convention page mirroring the auto-loaded agentsmd rule.

Adds conventions/pre-commit.mdx and the corresponding entry to
docs.json's Conventions group nav.

Covers:
  - Canonical homes table (Nix-path nix-devenv, non-Nix-path
    dryvist/.github precommit/, lint configs in dryvist/.github)
  - Six profiles (base, nix, markdown, terraform, ansible, python)
  - Consumer patterns for Nix and non-Nix paths with full snippets
  - The `nix flake init -t #with-hooks` scaffold
  - Why one canonical home per artifact (single update propagates,
    drift dies, one-line onboarding)
  - What stays per-repo (checkov, bandit, detect-secrets, AWS/GCP/
    Azure tflint plugins) and why
  - Known limitations matching the agentsmd rule

Mirrors:
  https://github.com/dryvist/ai-assistant-instructions/blob/main/agentsmd/rules/pre-commit.md

Refs: dryvist/nix-devenv#34, #35, dryvist/.github#12, dryvist/terraform-runs-on#80, dryvist/ai-assistant-instructions#661

Assisted-by: Claude <noreply@anthropic.com>

* docs(nav): wire conventions/pre-commit into docs.json sidebar

Forgot to stage the nav update in the previous commit; the page
exists but wasn't discoverable through the sidebar.

Assisted-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant