hercules-ci / flake-parts

❄️ Simplify Nix Flakes with the module system
https://flake.parts
MIT License
699 stars 38 forks source link

lib/`mkFlake`: Test suite improvements and more #183

Open bb010g opened 11 months ago

bb010g commented 11 months ago

Split out from #137. Please read the individual commit messages.

bb010g commented 11 months ago

Reading https://github.com/divnix/call-flake/commit/5828e083daac39efb098dc719502379f2bf2ed8a, it looks like both outPath and sourceInfo would have to be inputs to outputs that don't force self in order to consistently provide proper error messages when evaluation of self errors?

roberth commented 11 months ago

You mean https://github.com/NixOS/nix/pull/7796/commits/5d834c40d0a1e397cc650f88b1544ee2e5912400

both outPath and sourceInfo would have to be inputs

I don't think we need sourceInfo, but perhaps its metadata would be nice to use. We should be careful with metadata though, because differentiating by origin can be a double edged sword. We have to make sure that inputs are interchangeable: a fork should work just as well as the original. (Not saying this is an immediate problem; just raising awareness of the requirement)

would have to be inputs to outputs that don't force self in order to consistently provide proper error messages when evaluation of self errors?

Sounds about right. I think outPath would be a very unfortunate name for such a parameter. A similar effect could be achieved by asking the caller to say something like mkFlake { here = ./.; ... }.

Not sure if we should act on the "here" idea now. For most users it's probably better to get a change into Nix so we can improve this structurally without bothering them with an extra parameter.

bb010g commented 11 months ago

I don't think we need sourceInfo, but perhaps its metadata would be nice to use. We should be careful with metadata though, because differentiating by origin can be a double edged sword. We have to make sure that inputs are interchangeable: a fork should work just as well as the original. (Not saying this is an immediate problem; just raising awareness of the requirement)

Alright. Balancing this is hard when debug information is sourced the same as normal information.

Not sure if we should act on the "here" idea now. For most users it's probably better to get a change into Nix so we can improve this structurally without bothering them with an extra parameter.

I agree on this. A manual parameter that they have to set to ./flake.nix is definitely not what this should be long-term.