Skip to content

Commit e120bf9

Browse files
authored
[nix] Fix profile list index for raw flakes (#1471)
## 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? ```bash devbox add github:F1bonacc1/process-compose/v0.43.1 devbox update ```
1 parent 0eb470d commit e120bf9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/nix/nixprofile/profile.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,15 @@ func ProfileListIndex(args *ProfileListIndexArgs) (int, error) {
127127
return -1, err
128128
}
129129

130-
if !inCache {
130+
if !inCache && args.Package.IsDevboxPackage() {
131131
// This is an optimization for happy path when packages are added by flake reference. A resolved devbox
132132
// package *which was added by flake reference* (not by store path) should match the unlockedReference
133133
// of an existing profile item.
134134
ref, err := args.Package.NormalizedDevboxPackageReference()
135135
if err != nil {
136136
return -1, errors.Wrapf(err, "failed to get installable for %s", args.Package.String())
137137
}
138+
138139
for _, item := range items {
139140
if ref == item.unlockedReference {
140141
return item.index, nil

0 commit comments

Comments
 (0)