fix: Correctly resolve packages from preferences.packages.version #33
No reviewers
Labels
No labels
Compat
Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: auxolotl/labs#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "austreelis/fix/apply-version-alias-preference"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Before this, a value that does not correspond to an attribute under a
package alias'
versionswould make it default to the latest as definedby
lib.packages.getLatest, which isn't a silver bullt: it choose"bash5.2.15-bootstrap" for instance instead of stage1-passthrough (and I
don;t think we have an easy fix for that).
Given values like
"1.2.3"makes little sense inconfig.preferences.packages.version(because it's a package-set-widepreference), this means it was hardly ever useful.
before:
after:
preferences.packages.versioneee7a761ea@ -243,11 +243,22 @@ ininoutputs;WELL_KNOWN_ALIASES = [We should be able to dynamically compute this from the keys of
lib.types.alias.getSubOptions {}and some filtering. Whether we want to do that is another question, though.I thought about it but:
types.alias(e.g. if we add some platform config in it, we'd need to filter those out too), so I thought it wasn't worth ittypes.aliasfrom those well-known version aliases, but then I think we might still need to manually define how their default gets plumbed together.But I agree that getting rid of those notes would be nice :I
Oh crap, I just realized
types.platformalso needs updating liketypes.aliasdoes.You know what, I'll work on that in a follow-up, this PR was supposed to be a fix. the user-facing behavior is fixed, I (or anyone, but I can) will improve the internals later, but there might be more untangling needed than I expected.
edit: added a note and opened #34
@ -251,0 +255,4 @@prefered = config.preferences.packages.version;isWellKnown = builtins.elem prefered lib.packages.WELL_KNOWN_ALIASES;inif isWellKnown thenI think this condition isn't quite right - if a well known alias is configured in preferences, it'll always trigger this branch no matter what. It's causing eval failures on my end when this function is called with actual packages instead of an alias (since packages don't have a
latestattribute).I think resolve is not supposed to be only used to resolve "latest" or "stable" aliases. I agree that it's only used through this mechanics as of now and so this branch must always be taken if not given a proper derivation, but I don't think the function was supposed to be limited to to that usecase ?
If we don't see another, I'm enclined to remove that behavior, I'd rather add it again later if needed.
I'm not sure what you mean here - the issue with this condition is that it's causing eval failures, ie.
These happen because sometimes
resolveis called with a package (ie.lib.types.packageand notlib.types.alias). Only the latter type actually haslatestorstabledefined, and because the condition doesn't distinguish between the two types, it fails when it gets the former type.Oh my bad, seriously misread your comment 😅
I think what I meant to do was
if isWellKnown && alias ? ${prefered} then, that's a mistake I think, thanks !edit: pushed the change, passing a package directly doesn't fail anymore :3
eee7a761eato6b33b292cb6b33b292cbto8313551835Looks good!
Looks good, thanks! And thanks for the review @srxl!