Add .small GHC derivation variant and fix Hadrian profiling bug#2481
Open
Add .small GHC derivation variant and fix Hadrian profiling bug#2481
Conversation
Introduces a .small passthru variant on GHC derivations that opts out of profiling libraries and Haddock documentation, significantly reducing closure size for CI, Docker, and cross-compilation toolchain use cases. Also fixes a pre-existing bug where `enableLibraryProfiling = false` had no effect on Hadrian builds (GHC 9.4+): the `+no_profiled_libs` flavour transformer was only applied for GHCJS/Wasm targets, silently ignoring the parameter for all other platforms. Changes: - Add `enableHaddockDocs` parameter (default true, fully backwards-compatible) - Fix legacy make build: HADDOCK_DOCS=NO now also honours enableHaddockDocs - Fix Hadrian: +no_profiled_libs applied whenever enableLibraryProfiling=false - Hadrian: --docs=nothing when enableHaddockDocs=false, no-sphinx otherwise - Make sphinx and hscolour nativeBuildInputs conditional on enableHaddockDocs - Add .small passthru variant (enableLibraryProfiling=false, enableHaddockDocs=false) Usage: pkgs.haskell-nix.compiler.ghc967.small
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enableLibraryProfiling = falsewas silently ignored on Hadrian builds (GHC 9.4+): the+no_profiled_libsflavour transformer was only applied for GHCJS/Wasm targets, not when the parameter was set by callers.enableHaddockDocsparameter (defaulttrue, fully backwards-compatible) that disables Haddock generation for both legacy make and Hadrian builds..smallpassthru variant on every GHC derivation — following the same pattern as.dwarfand.smallAddressSpace— that disables both profiling libraries and Haddock docs, significantly reducing closure size for CI caches, Docker images, and cross-compilation toolchains.Changes (
compiler/ghc/default.nix)enableHaddockDocsparameter (defaulttrue) — legacy make setsHADDOCK_DOCS=NO; Hadrian uses--docs=nothinginstead of--docs=no-sphinx.+no_profiled_libsflavour transformer now applied whenever!enableLibraryProfiling, not only for GHCJS/Wasm targets.sphinxandhscolourare only included innativeBuildInputswhenenableHaddockDocs = true..smallpassthru — setsenableLibraryProfiling = falseandenableHaddockDocs = false.Usage
Test plan
nix eval .#legacyPackages.x86_64-linux.haskell-nix.compiler.ghc965 --apply 'x: x ? small'→truenix eval .#legacyPackages.x86_64-linux.haskell-nix.compiler.ghc965 --apply 'x: x ? dwarf && x ? smallAddressSpace'→true(existing variants unaffected)