New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tidy up the Coq package sets #32737
Tidy up the Coq package sets #32737
Conversation
This looks good to me. And I've done some testing under NixOS (with sandboxing). Given that the predicate is applied to the I suppose that what grahamcofborg-eval-check-meta shows is that this information should not be in the |
983c2fa
to
b014c15
Compare
pkgs/top-level/coq-packages.nix
Outdated
let pred = | ||
if p ? meta && p.meta ? compatibleCoqVersions | ||
then p.meta.compatibleCoqVersions | ||
else _: true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The predicate is equivalent to p ? meta.compatibleCoqVersions
, and the whole conditional is equivalent to p.meta.compatibleCoqVersions or (_: true)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that compatibleCoqVersions isn't a valid meta attribute. Maybe passthru
would be more appropriate?
pkgs/top-level/coq-packages.nix
Outdated
}; | ||
|
||
filterCoqPackages = coq: | ||
lib.filterAttrsRecursive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is lib.filterAttrs
insufficient?
pkgs/top-level/all-packages.nix
Outdated
coqPackages_8_7 = mkCoqPackages coqPackages_8_7 coq_8_7; | ||
coqPackages = coqPackages_8_6; | ||
coq = coqPackages.coq; | ||
inherit (coqLib) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May you inherit (callPackage ./coq-packages.nix {})
to avoid confusing naming. (Due to coqLib = ./coq-packages ≠ coqPackages
.)
Thanks for the comments. I addressed your concerns in 791776b. Do you know if there is a way to inherit all attributes from a set? Currently the line |
It all looks good to me, though I haven't had the time to try it out yet. |
Not an answer to this question, but we could also go the same route as |
@Zimmi48 Just above (#32737 (comment)) Orivej suggested not to introduce such an attribute (because of confusing naming). |
This PR looks ready to merge, but "coqPackages: wip" suggests that the last commit is work in progress, i.e. unfinished. Do you consider it ready?
There is |
791776b
to
79bebac
Compare
I just cleaned the commits and added some documentation. Also I add the library that is used as an example in the docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kudos for updating the doc!
doc/languages-frameworks/coq.xml
Outdated
generated using <literal>coq_makefile</literal> so we only have to | ||
depends on Coq. It builds on the Mathematical Components library, thus it | ||
also takes <literal>mathcomp</literal> as <literal>buildInputs</literal>. | ||
Its <literal>makefile</literal> has been generated using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a capital M here, especially since it is a literal.
|
||
buildInputs = [ coq ]; | ||
propagatedBuildInputs = [ mathcomp ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some Coq packages also propagate Coq. Should the rule be not to propagate it? In this case, we should probably update the packages which do not respect this rule.
And how important is it to propagate math-comp? Should Coq package dependencies be always propagated? There are also examples where it is not the case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should only be propagated if users of that library also (almost always) need to require import from mathcomp. Otherwise, they could specify mathcomp in their own dependencies list, right?
79bebac
to
fcb89df
Compare
Motivation for this change
See discussion of #30698.
cc/ @maximedenes @jwiegley @Zimmi48
There are three (3)
coqPackages_XX
set, one for each version of Coq (8.5, 8.6, 8.7); there are all built from the same functionmkCoqPackages
.Before this PR, this sets all have the same attributes but many libraries are not compatible with all these versions of Coq. Therefore, many derivations in these sets are broken: they either fail at evaluation or at build time. It makes difficult to know what are the available libraries in
nixpkgs
and whether something is broken by mistake or by design.The goal of this PR is that all attributes evaluate and build. Here is how it is achieved:
pkgs/top-level/coq-packages.nix
, available through thecoqLib
attribute.meta.compatibleCoqVersions
attributes: it is a function from version strings to booleans and tells whether said version is compatible with said library. If this attribute is missing, it means that the library is compatible with all versions (i.e., defaults to_: true
).coqPackages_XX
is filtered to keep only those attributes that are compatible with the corresponding Coq version.NB: I intended to do the filtering during the fixed point computation, but run into infinite loops. It’s probably not a big deal but I wished I understood what’s going on…
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)