@@ -483,10 +483,12 @@ func (d *Devbox) saveCfg() error {
483
483
}
484
484
485
485
func (d * Devbox ) Services () (services.Services , error ) {
486
- pluginSvcs , err := d .pluginManager .GetServices (
487
- d .PlatformPackages (),
488
- d .cfg .Include ,
489
- )
486
+ packages , err := d .InstallablePackages ()
487
+ if err != nil {
488
+ return nil , err
489
+ }
490
+
491
+ pluginSvcs , err := d .pluginManager .GetServices (packages , d .cfg .Include )
490
492
if err != nil {
491
493
return nil , err
492
494
}
@@ -824,7 +826,11 @@ func (d *Devbox) computeNixEnv(ctx context.Context, usePrintDevEnvCache bool) (m
824
826
// We still need to be able to add env variables to non-service binaries
825
827
// (e.g. ruby). This would involve understanding what binaries are associated
826
828
// to a given plugin.
827
- pluginEnv , err := d .pluginManager .Env (d .PlatformPackages (), d .cfg .Include , env )
829
+ installablePackages , err := d .InstallablePackages ()
830
+ if err != nil {
831
+ return nil , err
832
+ }
833
+ pluginEnv , err := d .pluginManager .Env (installablePackages , d .cfg .Include , env )
828
834
if err != nil {
829
835
return nil , err
830
836
}
@@ -926,20 +932,13 @@ func (d *Devbox) nixFlakesFilePath() string {
926
932
return filepath .Join (d .projectDir , ".devbox/gen/flake/flake.nix" )
927
933
}
928
934
929
- // Refactoring steps:
930
- // 1. Change all users of Packages() to ConfigPackageNames() or PlatformPackageNames()
931
- // 2. ConfigPackages() consumes d.cfg.Packages
932
- // 3. Change d.cfg.Packages.VersionedNames() callers to Packages() variants
933
- // 3. Change ConfigPackages() consumers to ConfigPackages() or PlatformPackages()
934
-
935
935
// ConfigPackageNames returns the package names as defined in devbox.json
936
936
func (d * Devbox ) ConfigPackageNames () []string {
937
937
return d .cfg .Packages .VersionedNames ()
938
938
}
939
939
940
- // PlatformPackageNames returns the names of packages that are to be installed
941
- // on the user's current platform.
942
- func (d * Devbox ) PlatformPackageNames () []string {
940
+ // InstallablePackageNames returns the names of packages that are to be installed
941
+ func (d * Devbox ) InstallablePackageNames () ([]string , error ) {
943
942
// TODO: next PR replaces this implementation
944
943
return d .cfg .Packages .VersionedNamesForPlatform ()
945
944
}
@@ -950,9 +949,13 @@ func (d *Devbox) ConfigPackages() []*devpkg.Package {
950
949
return devpkg .PackageFromStrings (d .ConfigPackageNames (), d .lockfile )
951
950
}
952
951
953
- // PlatformPackages returns the packages that are to be installed
954
- func (d * Devbox ) PlatformPackages () []* devpkg.Package {
955
- return devpkg .PackageFromStrings (d .PlatformPackageNames (), d .lockfile )
952
+ // InstallablePackages returns the packages that are to be installed
953
+ func (d * Devbox ) InstallablePackages () ([]* devpkg.Package , error ) {
954
+ names , err := d .InstallablePackageNames ()
955
+ if err != nil {
956
+ return nil , err
957
+ }
958
+ return devpkg .PackageFromStrings (names , d .lockfile ), nil
956
959
}
957
960
958
961
func (d * Devbox ) Includes () []plugin.Includable {
0 commit comments