-
Notifications
You must be signed in to change notification settings - Fork 249
Docs for platform-specific packages #1441
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
{ | ||
"packages": [ | ||
"yarn", | ||
"nodejs" | ||
], | ||
"shell": { | ||
"init_hook": null | ||
"packages": { | ||
"yarn": "latest", | ||
"nodejs": "latest" | ||
}, | ||
"shell": {}, | ||
"nixpkgs": { | ||
"commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{ | ||
"lockfile_version": "1", | ||
"packages": { | ||
"nodejs": { | ||
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#nodejs" | ||
"nodejs@latest": { | ||
"last_modified": "2023-08-30T00:25:28Z", | ||
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#nodejs_20", | ||
"source": "devbox-search", | ||
"version": "20.5.1" | ||
}, | ||
"yarn": { | ||
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#yarn" | ||
"yarn@latest": { | ||
"last_modified": "2023-08-30T00:25:28Z", | ||
"resolved": "github:NixOS/nixpkgs/a63a64b593dcf2fe05f7c5d666eb395950f36bc9#yarn", | ||
"source": "devbox-search", | ||
"version": "1.22.19" | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--- | ||
title: Installing Platform Specific Packages | ||
--- | ||
|
||
At times, you may need to install a package or library that is only available on a specific platform. For example, you may want to install a package that is only available on Linux, while still using the same Devbox configuration on your Mac. | ||
|
||
Devbox allows you to specify which platforms a package should be installed on using the `--platform` and `--exclude-platform` flags. When a package is added using these flags, it will be added to your `devbox.json`, but will only be installed when you run Devbox on a matching platform. | ||
|
||
:::info | ||
|
||
Specifying platforms for packages will alter your `devbox.json` in a way that is only compatible with **Devbox 0.5.12** and newer. | ||
|
||
If you encounter errors trying to run a Devbox project with platform-specific packages, you may need to run `devbox version update` | ||
::: | ||
|
||
## Installing Platform Specific Packages | ||
|
||
To avoid build or installation errors, you can tell Devbox to only install a package on specific platforms using the `--platform` flag when you run `devbox add`. | ||
|
||
For example, to install the `busybox` package only on Linux platforms, you can run: | ||
|
||
```bash | ||
devbox add busybox --platform x86_64-linux,aarch64-linux | ||
``` | ||
|
||
This will add busybox to your `devbox.json`, but will only install it when use devbox on a Linux machine. The packages section in your config will look like the following | ||
|
||
```json | ||
{ | ||
"packages": { | ||
"busybox": { | ||
"version": "latest", | ||
"platforms": ["x86_64-linux", "aarch64-linux"] | ||
} | ||
} | ||
|
||
``` | ||
|
||
## Excluding a Package from Specific Platforms | ||
|
||
You can also tell Devbox to exclude a package from a specific platform using the `--exclude-platform` flag. For example, to avoid installing `ripgrep` on an ARM-based Mac, you can run: | ||
|
||
|
||
```bash | ||
devbox add ripgrep --exclude-platform aarch64-darwin | ||
``` | ||
|
||
This will add ripgrep to your `devbox.json`, but will not install it when use devbox on an ARM-based Mac. The packages section in your config will look like the following: | ||
|
||
```json | ||
{ | ||
"packages": { | ||
"ripgrep": { | ||
"version": "latest", | ||
"excluded_platforms": ["aarch64-darwin"] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Supported Platforms | ||
|
||
Valid Platforms include: | ||
|
||
* `aarch64-darwin` | ||
* `aarch64-linux` | ||
* `x86_64-darwin` | ||
* `x86_64-linux` | ||
|
||
The platforms below are also supported, but will build packages from source | ||
|
||
* `i686-linux` | ||
* `armv7l-linux` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.