Skip to content

[nix] Fix profile list index for raw flakes #1471

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

Merged
merged 2 commits into from
Sep 12, 2023
Merged

Conversation

mikeland73
Copy link
Contributor

Summary

ProfileListIndex was broken for raw flakes. This would break devbox update

I could have left the return -1, errors.Wrap(nix.ErrPackageNotFound, args.Package.String()) inside the if statement, but it seems safer to just to attempt the slow matching instead of returning an error and only returning an error after all matching fails.

Blame PR: #1422

How was it tested?

devbox add github:F1bonacc1/process-compose/v0.43.1
devbox update

@mikeland73 mikeland73 requested review from savil and ipince September 12, 2023 17:58
for _, item := range items {
if ref == item.unlockedReference {
return item.index, nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather implement this as:

if !inCache && args.Package.IsDevboxPackage() {
 
   ...
   return -1, errors.Wrap(nix.ErrPackageNotFound, args.Package.String())
}

so that the if-statement does not fallthrough and we don't have to consider DevboxPackages when reasoning about the code below.

Alternatively, is this optimization saving meaningful time? If not, lets drop it.

@mikeland73 mikeland73 merged commit e120bf9 into main Sep 12, 2023
@mikeland73 mikeland73 deleted the landau/fix-flake-index branch September 12, 2023 19:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants