-
Notifications
You must be signed in to change notification settings - Fork 249
[errors] Show nicer error when installing a package that is not supported by current system #1279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…rted by current system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is pretty close, but I think if we just try evaluating the derivation we could catch more errors. Would that work?
internal/nix/eval.go
Outdated
@@ -46,6 +46,21 @@ func PackageKnownVulnerabilities(path string) []string { | |||
return vulnerabilities | |||
} | |||
|
|||
func PackagePlatforms(path string) []string { | |||
cmd := command("eval", path+".meta.platforms", "--json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if instead of searching and eval'ing the platforms we just eval the derivation's outPath and check the output? For example:
# Bad
$ nix eval --raw nixpkgs#fuse3
error: Package ‘fuse-3.11.0’ in /nix/store/b63zicy7mkwlp4vmca056kawsrmxfr36-source/pkgs/os-specific/linux/fuse/common.nix:92 is not available on the requested hostPlatform:
hostPlatform.config = "aarch64-apple-darwin"
package.meta.platforms = [
...
vs.
# Good
$ nix eval --raw nixpkgs#fuse
/nix/store/8pqmbsp8zkq8656k5yaravbaxixaaa3c-macfuse-stubs-4.4.1
@gcurtis PTAL |
…th installing package that is uninstallable on user's platform (#1364) ## Summary Changes the error message to suggest using `--platform/--exclude-platform` with `devbox add`. I wish we had a way to recommend the platforms that are supported for the exact package being installed, but we don't. The heavy lifting for this was done in #1279. Thanks @mikeland73! ## How was it tested? ``` > devbox add glibcLocales Installing package: glibcLocales. Error: package glibcLocales cannot be installed on your platform x86_64-darwin. Consider using `--platform` or `--exclude-platform` with `devbox add` to install on a supported platform. Other available platforms are: aarch64-darwin, aarch64-linux, i686-linux, x86_64-linux, armv7l-linux. ``` <img width="949" alt="Screenshot 2023-08-10 at 4 20 18 PM" src="https://github.com/jetpack-io/devbox/assets/676452/95ddff88-793b-4c09-9e65-be344d303c2a">
…1463) ## Summary Restores functionality implemented by #1264 and refactored in #1279 which was accidentally broken by #1437 tldr: the `FillNarInfoCache` function breaks if packages are not in search, but we support non-search packages via fallback (.e.g. stdenv.cc.cc.lib) I'm keeping surface area as small as possible, but as a follow up I think we can remove the `devpkg.FillNarInfoCache` calls from `impl.Add` if we simply ignore the`IsInBinaryCache` errors in [ValidateExists](https://github.com/jetpack-io/devbox/blob/main/internal/devpkg/validation.go#L10-L26) or remove `IsInBinaryCache` from that function completely (I'm not convinced it is needed, @savil @ipince correct me if I'm wrong) ## How was it tested? `devbox add stdenv.cc.cc.lib`
Summary
Shows better error messages in following cases:
How was it tested?
devbox add [email protected]
devbox add fuse3