Add horizon.ghc module with automatic README generation
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, andsections(each withheadingandcontent) -
Automatic regeneration: README.md is regenerated on
nix fmtvia treefmt formatter -
CI validation:
nix fmt --fail-on-changefails if README is out of sync, ensuring READMEs stay current -
Reusable: Used by both
horizon.ghcandhorizon.packageSetmodules
2. horizon.ghc Module
A simplified wrapper around ghc-common-hadrian for building GHC:
-
Simple configuration: Just specify
version,sha256,bootPkgs, and optionaldescription - Automatic README: Generates README with GHC version, build instructions, and bootstrap info
-
Consistent pattern: Follows same design as
horizon.packageSetmodule
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.packageSetto use the newreadmemodule for consistency - All test flakes demonstrate proper usage and automatic README generation
Testing
-
✅ nix flake showevaluates successfully on all test flakes -
✅ nix fmtregenerates README.md files correctly -
✅ nix fmt --fail-on-changefails when READMEs are out of sync