Skip to content

Add horizon.ghc module with automatic README generation

Horizon Bot requested to merge add-horizon-ghc-module into master

Summary

This MR adds two new flake-parts modules for enhanced Horizon tooling:

1. readme Module

A reusable flake-parts module for automatic README.md generation:

  • Structured configuration: Configure via title, description, and sections (each with heading and content)
  • Automatic regeneration: README.md is regenerated on nix fmt via treefmt formatter
  • CI validation: nix fmt --fail-on-change fails if README is out of sync, ensuring READMEs stay current
  • Reusable: Used by both horizon.ghc and horizon.packageSet modules

2. horizon.ghc Module

A simplified wrapper around ghc-common-hadrian for building GHC:

  • Simple configuration: Just specify version, sha256, bootPkgs, and optional description
  • Automatic README: Generates README with GHC version, build instructions, and bootstrap info
  • Consistent pattern: Follows same design as horizon.packageSet module

Configuration Example

horizon.ghc = {
  enable = true;
  version = "9.14.1";
  sha256 = "sha256-KoN3nJr4ZVSjKJ8nh6ONaqg9ANE2qp+SA2HdaTwQHnc=";
  bootPkgs = pkgs.haskell.packages.ghc910;
  description = "Test GHC build for horizon-flake-parts";
};

Additional Changes

  • Updated horizon.packageSet to use the new readme module for consistency
  • All test flakes demonstrate proper usage and automatic README generation

Testing

  • nix flake show evaluates successfully on all test flakes
  • nix fmt regenerates README.md files correctly
  • nix fmt --fail-on-change fails when READMEs are out of sync

🤖 Generated with Claude Code

Edited by Horizon Bot

Merge request reports