Skip to content

Check materialization in pure nix #2051

Closed
@anka-213

Description

@anka-213

Is your feature request related to a problem? Please describe.
I want to avoid IFD as much as possible since it causes a bunch of problems, like dry-run not working, not being supported by flakehub etc. Materialization is a solution to this, but now the materialized expressions risk getting outdated. Enabling checkMaterialization is just a regression to using IFD again.

Describe the solution you'd like
My proposal is to within the materialized files write hashes of all the relevant files that affect the materialization, in particular files like <packagename>.cabal, stack.yaml and cabal.project should be sufficient unless I'm missing something. That way we could cheaply check if the materialized expressions might be outdated in pure nix code without needing to do the full reevaluation.

Describe alternatives you've considered
The documentation recommends enabling checkMaterialization in CI only, but I'm not sure how to do that and it will still needlessly slow down CI in cases where nothing has changed.

Potential issues
One issue I can think of if this were enabled by default is that it might trigger re-checking more often than necessary if the changes are minor and can't change the result. There is also a risk that sometimes causing IFD and sometimes not depending on which files have changed would be confusing behaviour for the users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions