zz: install modules shipped with compiler #110771
Merged
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.
Motivation for this change
Previously zz wouldn't be able to compile anything using standard
modules like
mem
orlog
out of the box.To fix this we copy the modules directory included in the source to
$out/share/zz/modules
and add an entry toZZ_MODULE_PATHS
in the wrapperaround zz.
We also remove a search path entry which used to reference
/build
because it used
CARGO_MANIFEST_DIR
at build time. The default searchpath now includes:
/nix/store/modules
$out/share/zz/modules
$(pwd)/modules
Patching out
/nix/store/modules
would be kind of cumbersome as it is amulti-line entry, but it probably does no harm and fine to leave in.
An issue arising by this PR might be that the added search path entry
may take priority over an user specified location even though we use
--suffix
. This is because zz internally uses aHashSet
which has noguaranteed iteration order. This may lead to unexpected behavior for
users wo previously provided custom versions of the standard modules via
ZZ_MODULE_PATHS
. However, this is an issue in upstream issue as wellwhere
ZZ_MODULE_PATHS
may or may not take priority over the compiled insearch path, so this issue should probably be resolved upstream (I'll
file a report or PR).
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)