Skip to content

Commit 159c801

Browse files
authored
[per-OS Packages] Improve error message if package is uninstallable (#1387)
## Summary Instead of gating the entire per-OS packages feature due to __some__ packages not being installable on the user's platform for that particular version, I propose this PR. Here, we modify the error message to be less prescriptive. We explain the two scenarios and let the user pick. This is obviously not the ideal UX. But a good enough measure until we can provide firmer guidance on which version of the package may work for this platform? ## How was it tested? in axiom on mac, did `devbox update` and saw: ``` Ensuring packages are installed. Installing package: gotty@latest. Error: package gotty@latest cannot be installed on your platform x86_64-darwin. If you know this package is incompatible with x86_64-darwin, then you could run `devbox add gotty@latest --exclude-platform x86_64-darwin` and re-try. If you think this package should be compatible with x86_64-darwin, then it's possible this particular version is not available yet from the nix registry. You could try `devbox add` with a different version for this package. ```
1 parent c43e963 commit 159c801

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

internal/nix/nixprofile/profile.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,14 @@ func ProfileInstall(ctx context.Context, args *ProfileInstallArgs) error {
272272
if exists, err := input.ValidateInstallsOnSystem(); err != nil {
273273
return err
274274
} else if !exists {
275-
platform := " " + nix.System()
275+
platform := nix.System()
276276
return usererr.New(
277-
"package %s cannot be installed on your platform%s. "+
278-
"Run `devbox add %[1]s --exclude-platform%[2]s` and re-try.",
277+
"package %s cannot be installed on your platform %s.\n"+
278+
"If you know this package is incompatible with %[2]s, then "+
279+
"you could run `devbox add %[1]s --exclude-platform %[2]s` and re-try.\n"+
280+
"If you think this package should be compatible with %[2]s, then "+
281+
"it's possible this particular version is not available yet from the nix registry. "+
282+
"You could try `devbox add` with a different version for this package.\n",
279283
input.Raw,
280284
platform,
281285
)

0 commit comments

Comments
 (0)