Skip to content

Commit 8b2a707

Browse files
committed
remove ProfileInstallPackage
1 parent 60a5a15 commit 8b2a707

File tree

2 files changed

+12
-31
lines changed

2 files changed

+12
-31
lines changed

internal/devbox/util.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"path/filepath"
1111

1212
"github.com/pkg/errors"
13+
"go.jetpack.io/devbox/internal/devpkg"
1314
"go.jetpack.io/devbox/internal/integrations/envsec"
1415
"go.jetpack.io/devbox/internal/nix/nixprofile"
1516

@@ -20,15 +21,19 @@ import (
2021
// It's used to install applications devbox might need, like process-compose
2122
// This is an alternative to a global install which would modify a user's
2223
// environment.
23-
func (d *Devbox) addDevboxUtilityPackage(ctx context.Context, pkg string) error {
24+
func (d *Devbox) addDevboxUtilityPackage(ctx context.Context, pkgName string) error {
25+
pkg := devpkg.PackageFromStringWithDefaults(pkgName, d.lockfile)
26+
installable, err := pkg.Installable()
27+
if err != nil {
28+
return err
29+
}
2430
profilePath, err := utilityNixProfilePath()
2531
if err != nil {
2632
return err
2733
}
28-
29-
return nixprofile.ProfileInstallPackage(ctx, &nixprofile.ProfileInstallPackageArgs{
30-
Lockfile: d.lockfile,
31-
Package: pkg,
34+
return nixprofile.ProfileInstall(ctx, &nixprofile.ProfileInstallArgs{
35+
Installable: installable,
36+
PackageName: pkgName,
3237
ProfilePath: profilePath,
3338
Writer: d.stderr,
3439
})

internal/nix/nixprofile/profile.go

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -194,32 +194,6 @@ func parseNixProfileListItem(line string) (*NixProfileListItem, error) {
194194
}, nil
195195
}
196196

197-
// TODO drop the Profile prefix from this name.
198-
type ProfileInstallPackageArgs struct {
199-
CustomStepMessage string
200-
Lockfile *lock.File
201-
Package string
202-
ProfilePath string
203-
Writer io.Writer
204-
}
205-
206-
// ProfileInstallPackage installs a Devbox package into a profile.
207-
// TODO drop the Profile prefix from this name.
208-
func ProfileInstallPackage(ctx context.Context, args *ProfileInstallPackageArgs) error {
209-
pkg := devpkg.PackageFromStringWithDefaults(args.Package, args.Lockfile)
210-
installable, err := pkg.Installable()
211-
if err != nil {
212-
return err
213-
}
214-
return ProfileInstall(ctx, &ProfileInstallArgs{
215-
CustomStepMessage: args.CustomStepMessage,
216-
Installable: installable,
217-
PackageName: args.Package,
218-
ProfilePath: args.ProfilePath,
219-
Writer: args.Writer,
220-
})
221-
}
222-
223197
// TODO drop the Profile prefix from this name.
224198
type ProfileInstallArgs struct {
225199
CustomStepMessage string
@@ -230,6 +204,8 @@ type ProfileInstallArgs struct {
230204
Writer io.Writer
231205
}
232206

207+
// ProfileInstall installs a package into a profile. Its a convenience wrapper around nix.ProfileInstall
208+
// that can print nicer output when installing multiple packages.
233209
// TODO drop the Profile prefix from this name.
234210
func ProfileInstall(ctx context.Context, args *ProfileInstallArgs) error {
235211
stepMsg := args.PackageName

0 commit comments

Comments
 (0)