devbox README

The project's README from github.com/jetify-com/devbox. As one markdown file: README.md.

Devbox logo.

Devbox

Instant, easy, and predictable development environments

Join Discord License: Apache 2.0 version tests Built with Devbox

What is it?

Devbox is a command-line tool that lets you easily create isolated shells for development. You start by defining the list of packages required by your development environment, and devbox uses that definition to create an isolated environment just for your application.

In practice, Devbox works similar to a package manager like yarn – except the packages it manages are at the operating-system level (the sort of thing you would normally install with brew or apt-get). With Devbox, you can install over 400,000 package versions from the Nix Package Registry

Devbox was originally developed by Jetify and is internally powered by nix.

Demo

The example below creates a development environment with python 3.10 and go 1.18, even though those packages are not installed in the underlying machine. You can run commands in the environment with devbox run, or start an interactive shell in it with devbox shell:

screen cast

Installing Devbox

Use the following install script to get the latest version of Devbox:

curl -fsSL https://get.jetify.com/devbox | bash

Read more on the Devbox docs.

Benefits

A consistent shell for everyone on the team

Declare the list of tools needed by your project via a devbox.json file and run devbox shell. Everyone working on the project gets a shell environment with the exact same version of those tools.

Try new tools without polluting your laptop

Development environments created by Devbox are isolated from everything else in your laptop. Is there a tool you want to try without making a mess? Add it to a Devbox shell, and remove it when you don't want it anymore – all while keeping your laptop pristine.

Don't sacrifice speed

Devbox can create isolated environments right on your laptop, without an extra-layer of virtualization slowing your file system or every command. When you're ready to ship, it'll turn it into an equivalent container – but not before.

Goodbye conflicting versions

Are you working on multiple projects, all of which need different versions of the same binary? Instead of attempting to install conflicting versions of the same binary on your laptop, create an isolated environment for each project, and use whatever version you want for each.

Take your environment with you

Devbox's dev environments are portable. We make it possible to declare your environment exactly once, and use that single definition in several different ways, including:

Quickstart: Fast, Deterministic Shell

In this quickstart we'll create a development shell with specific tools installed. These tools will only be available when using this Devbox shell, ensuring we don't pollute your machine.

  1. Open a terminal in a new empty folder.

  2. Initialize Devbox:

    devbox init
    

    This creates a devbox.json file in the current directory. You should commit it to source control.

  3. Add command-line tools from Nix. For example, to add Python 3.10:

    devbox add [email protected]
    

    Search for more packages on Nixhub.io

  4. Your devbox.json file keeps track of the packages you've added, it should now look like this:

    {
      "packages": [
        "[email protected]"
      ]
    }
    
  5. Start a new shell that has these tools installed:

    devbox shell
    

    You can tell you're in a Devbox shell (and not your regular terminal) because the shell prompt changed.

  6. Use your favorite tools.

    In this example we installed Python 3.10, so let's use it.

    python --version
    
  7. Your regular tools are also available including environment variables and config settings.

    git config --get user.name
    
  8. To exit the Devbox shell and return to your regular shell:

    exit
    

Read more on the Devbox docs Quickstart.

Additional commands

devbox help - see all commands

See the CLI Reference for the full list of commands.

Join our Developer Community

Contributing

Devbox is an opensource project, so contributions are always welcome. Please read our contributing guide before submitting pull requests.

Devbox development readme

Thanks to Nix for providing isolated shells.

License

This project is proudly open-source under the Apache 2.0 License

devbox (jetify-com/devbox)

Searching Database…

12.4K ·GitHub
这是什么?Devbox 是一款命令行工具,通过在 devbox.json 文件中声明软件包,创建相互隔离、可复现的开发环境。它底层使用 Nix,而不是 Docker 或虚拟机。
它更像包管理器,还是虚拟机?它的行为类似 yarn 这样的包管理器,区别在于它安装的是操作系统级别的工具(通常通过 brew 或 apt-get 获取),而不只是编程语言的包。
我该如何用它启动一个项目?在空文件夹中运行 devbox init 以创建 devbox.json,用 devbox add 添加工具(例如 python 3.10),然后用 devbox shell 进入该环境。
我需要先自己安装 Nix 吗?不需要,只需运行 Devbox 自带的安装脚本即可。Devbox 底层由 Nix 驱动,并会替你处理这部分集成。
它会像虚拟机那样拖慢我的电脑吗?不会。Devbox 直接在你的笔记本电脑上构建隔离环境,没有额外的虚拟化层,因此文件系统访问和命令执行都很快;只有在你明确打包发布时,它才会变成容器。
这是给个人单独使用的,还是给整个团队用的?两者都适用。共享的 devbox.json 能让每位团队成员使用完全相同的工具版本;个人也可以在隔离环境中试用工具,而不影响自己主要的笔记本设置。
用 Devbox 实际能安装多少个软件包?Devbox 可以访问 Nix Package Registry 中超过 40 万个软件包版本,你可以在 Nixhub.io 上搜索。
我能把 Devbox 环境变成生产容器吗?可以。同一份 devbox.json 定义可以生成 Dockerfile 或 VS Code devcontainer,因此生产镜像与你的开发环境使用完全相同的工具。
为什么要用 Nix,而不直接用 Docker?Nix 让 Devbox 可以直接把软件包安装到你的机器上,无需容器或虚拟机层,因此开发环境能瞬间启动,只有在准备发布时才需要容器化。
Devbox 也能驱动远程云端开发环境吗?可以。同一份 devbox.json 定义同样可以驱动云端的远程开发环境,并与你的本地设置保持一致。
What are similar projects?agentbox, tilt, podman, earthly, buildkit, devpod, dagger, colima
Creator
jetify-com
Size
42.9 MB
Stars
12.4K
Age
4y
Commits · 90 Days