@@ -105,11 +105,11 @@ type ProfileListIndexArgs struct {
105
105
Items []* NixProfileListItem
106
106
Lockfile * lock.File
107
107
Writer io.Writer
108
- DevPkg * devpkg.Package
108
+ Package * devpkg.Package
109
109
ProfileDir string
110
110
}
111
111
112
- // ProfileListIndex returns the index of args.DevPkg in the nix profile specified by args.ProfileDir,
112
+ // ProfileListIndex returns the index of args.Package in the nix profile specified by args.ProfileDir,
113
113
// or -1 if it's not found. Callers can pass in args.Items to avoid having to call `nix-profile list` again.
114
114
func ProfileListIndex (args * ProfileListIndexArgs ) (int , error ) {
115
115
var err error
@@ -121,30 +121,30 @@ func ProfileListIndex(args *ProfileListIndexArgs) (int, error) {
121
121
}
122
122
}
123
123
124
- inCache , err := args .DevPkg .IsInBinaryCache ()
124
+ inCache , err := args .Package .IsInBinaryCache ()
125
125
if err != nil {
126
126
return - 1 , err
127
127
}
128
128
if inCache {
129
129
// Packages in cache are added by store path, which means we only need to check
130
130
// for store path equality to find it.
131
- pathInStore , err := args .DevPkg .Installable ()
131
+ pathInStore , err := args .Package .Installable ()
132
132
if err != nil {
133
- return - 1 , errors .Wrapf (err , "failed to get installable for %s" , args .DevPkg .String ())
133
+ return - 1 , errors .Wrapf (err , "failed to get installable for %s" , args .Package .String ())
134
134
}
135
135
for _ , item := range items {
136
136
if pathInStore == item .nixStorePath {
137
137
return item .index , nil
138
138
}
139
139
}
140
- return - 1 , errors .Wrap (nix .ErrPackageNotFound , args .DevPkg .String ())
140
+ return - 1 , errors .Wrap (nix .ErrPackageNotFound , args .Package .String ())
141
141
}
142
142
143
- // else: check if the DevPkg matches an item's unlockedReference.
143
+ // else: check if the Package matches an item's unlockedReference.
144
144
// This is an optimization for happy path. A resolved devbox package *which was added by
145
145
// flake reference* (not by store path) should match the unlockedReference of an existing
146
146
// profile item.
147
- ref , err := args .DevPkg .NormalizedDevboxPackageReference ()
147
+ ref , err := args .Package .NormalizedDevboxPackageReference ()
148
148
if err != nil {
149
149
return - 1 , err
150
150
}
@@ -158,11 +158,11 @@ func ProfileListIndex(args *ProfileListIndexArgs) (int, error) {
158
158
for _ , item := range items {
159
159
existing := item .ToPackage (args .Lockfile )
160
160
161
- if args .DevPkg .Equals (existing ) {
161
+ if args .Package .Equals (existing ) {
162
162
return item .index , nil
163
163
}
164
164
}
165
- return - 1 , errors .Wrap (nix .ErrPackageNotFound , args .DevPkg .String ())
165
+ return - 1 , errors .Wrap (nix .ErrPackageNotFound , args .Package .String ())
166
166
}
167
167
168
168
// parseNixProfileListItem reads each line of output (from `nix profile list`) and converts
0 commit comments