Skip to content

Preserve per-component build info until pretty-printing #709

Open
alexfmpe wants to merge 2 commits intoNixOS:masterfrom
alexfmpe:tree
Open

Preserve per-component build info until pretty-printing #709
alexfmpe wants to merge 2 commits intoNixOS:masterfrom
alexfmpe:tree

Conversation

@alexfmpe
Copy link
Copy Markdown
Member

@alexfmpe alexfmpe commented Mar 19, 2026

Standalone mergeable step from my work on preserving cabal conditionals into nix.

Since that means that whether a component is buildable might only be determinable at eval time, we can't blindly fold them.

The first commit mostly cleans up stuff so the commit with the actual change can be simpler.

, "tasty-discover"
, "hsx2hs"
, "markdown-unlit"
]
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mostly rewrote this because I was having trouble getting the lenses to play nice with the subsequent change

| otherwise = True

convertBuildInfo :: Cabal.BuildInfo -> Nix.BuildInfo
convertBuildInfo Cabal.BuildInfo {..} | not buildable = mempty
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly this line seems to have no effect, because finalizePD silently drops buildable: false components

]
where
pPrintBuildInfo' :: String -> [(BuildInfo, Bool)] -> Doc
pPrintBuildInfo' name = pPrintBuildInfo name . foldMap fst . filter snd
Copy link
Copy Markdown
Member Author

@alexfmpe alexfmpe Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filter snd coincidentally doesn't seem to have effect due to the way finalizePD works (see below comment), but I think it'd be very confusing not having it

@alexfmpe alexfmpe changed the title Store per-component info in 'Derivation' Preserve per-component build info until pretty-printing Mar 24, 2026
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