-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Unwanted boilerplate: finalAttrs.finalPackage.doCheck #272978
Copy link
Copy link
Open
Labels
2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: cross-compilationBuilding packages on a different platform than they will be used onBuilding packages on a different platform than they will be used on6.topic: stdenvStandard environmentStandard environment9.needs: documentationThis needs to be documented well.This needs to be documented well.
Metadata
Metadata
Assignees
Labels
2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.mdhttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: cross-compilationBuilding packages on a different platform than they will be used onBuilding packages on a different platform than they will be used on6.topic: stdenvStandard environmentStandard environment9.needs: documentationThis needs to be documented well.This needs to be documented well.
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status
Currently much cross logic is not included in the
finalAttrsfixed point, meaning that if you usefinalAttrs.doCheckinternally in your derivation then this does not automatically account for whetherstdenv.buildPlatform.canExecute stdenv.hostPlatform.The current most elegant fix is to inject
finalPackageinto the expression, but this is not documented.Example
For example, consider:
nixpkgs/pkgs/development/libraries/libspatialindex/default.nix
Lines 25 to 27 in 221b92f
The fix is to inject
finalPackage:nixpkgs/pkgs/development/libraries/libspatialindex/default.nix
Lines 25 to 27 in ad5e744
which will get us
The current recommendation in the docs (added in 2017) is to hoist the cross logic up into the derivation:
nixpkgs/doc/stdenv/cross-compilation.chapter.md
Lines 148 to 154 in 5a67e32
Tree-wide fixes are simple to apply, but are ultimately a bodge. Hence this issue
Related: #266485
Add a 👍 reaction to issues you find important.