Git Product home page Git Product logo

jetpack-io / devbox Goto Github PK

View Code? Open in Web Editor NEW
7.5K 35.0 167.0 27.06 MB

Instant, easy, and predictable development environments

Home Page: https://www.jetify.com/devbox/

License: Apache License 2.0

Go 95.76% TypeScript 2.31% HTML 0.02% Shell 0.53% CSS 0.01% Less 0.01% Nix 1.36%
devbox development-environment nix venv virtual-environment virtualization build-system build-tool buildpack containers dev-environment

devbox's Introduction

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

You can try out Devbox in your browser using the button below:

Open In Devbox.sh

The example below creates a development environment with python 2.7 and go 1.18, even though those packages are not installed in the underlying machine:

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.

Good-bye 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:

  • A local shell created through devbox shell
  • A devcontainer you can use with VSCode
  • A Dockerfile so you can build a production image with the exact same tools you used for development.
  • A remote development environment in the cloud that mirrors your local environment.

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:

    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

Related Work

Thanks to Nix for providing isolated shells.

Translation

License

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

devbox's People

Contributors

adamdicarlo0 avatar akiyamka avatar angelside avatar az-pz avatar bketelsen avatar dependabot[bot] avatar devholic avatar eltimn avatar gcurtis avatar hezhizhen avatar httpete avatar iocron avatar ipince avatar kadaan avatar lagoja avatar literatesnow avatar loreto avatar lucilleh avatar mauricioabreu avatar mikeland73 avatar mikenikles avatar mohsenari avatar mstruebing avatar parviste-fortum avatar ragingpastry avatar robrich avatar savil avatar sigprof avatar t-monaghan avatar tclasen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devbox's Issues

Language Request: Rust

Lovely project! Would love to request auto language detection for Rust. I'll go through the code later and see if I can make a PR to do the same.

execute `devbox shell` with error

❗ execute devbox shell with error

Installing nix packages. This may take a while...
Starting a devbox shell...
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Builder, source: Os { code: 2, kind: NotFound, message: "No such file or directory" } }', /Users/ciaccount/.cargo/registry/src/github.com-1ecc6299db9ec823/sentry-0.27.0/src/transports/reqwest.rs:55:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

✅ execute nix-shell .devbox/gen/shell.nix success


Simple system Info

  • System Version: macOS 13.0 (22A5331f)
  • Kernel Version: Darwin 22.1.0
  • Model Name: MacBook Pro
  • Model Identifier: MacBookPro17,1
  • Chip: Apple M1

Segment telemetry POST Connection refused

Hey,

Anytime I do any dev box command I get the following error:

segment 2022/09/06 11:25:58 ERROR: sending request - Post "https://api.segment.io/v1/batch": dial tcp 165.22.57.39:443: connect: connection refused
segment 2022/09/06 11:25:58 ERROR: 1 messages dropped because they failed to be sent and the client was closed

Feature request: Am I in a shell? a nested shell?

Add a discover-inception command. e.g. devbox which or devbox whereami outputs if I'm in a shell, and if that's in a shell and if that's in a shell recursively. Perhaps add a -v that outputs the packages / env vars defined in that shell at each level. If you're not in a shell it notes that too.

Package collision in `devbox build`, but not in `devbox shell`

I created a rust devbox with the following devbox.json:

{
  "packages": [
    "rustc",
    "cargo",
    "rustfmt",
    "rust-analyzer",
    "clippy",
    "libiconv",
    "rustup"
  ]
}

If I run devbox shell, the shell builds and resolves successfully:

$ devbox shell
Installing nix packages. This may take a while...
Starting a devbox shell...

~/src/devbox-rust ⌚ 15:02:27 in Devbox 📦
$ which rustfmt
/nix/store/nvl54qi7dm5i70zr5sd5a754dnvlhjpj-rustfmt-1.62.1/bin/rustfmt

~/src/devbox-rust ⌚ 15:02:33 in Devbox 📦
$ which rustup
/nix/store/v45dr5grllzm8vnmr0ww4imibk8njw36-rustup-1.25.1/bin/rustup

However, when I run devbox build, I get the error:

#0 41.07 error: collision between `/nix/store/7838y8gxbkw2w4h1z7hpzbvl3x447h11-rustup-1.25.1/bin/rustfmt' and `/nix/store/dqrndqjk2iry9r2m0n5sls7wdiavwl7b-rustfmt-1.62.1/bin/rustfmt'

Full output

$ devbox build
[+] Building 44.2s (14/19)                                                      
 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 1.79kB                                     0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => resolve image config for docker.io/docker/dockerfile:1                 1.3s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:9ba7531bd8  0.0s
 => [internal] load build definition from Dockerfile                       0.0s
 => [internal] load .dockerignore                                          0.0s
 => [internal] load metadata for gcr.io/distroless/base:debug              0.3s
 => [internal] load metadata for docker.io/nixos/nix:2.10.3                0.7s
 => CACHED [stage-2 1/3] FROM gcr.io/distroless/base:debug@sha256:65afaf8  0.0s
 => [internal] load build context                                          0.0s
 => => transferring context: 8.78kB                                        0.0s
 => CACHED [base 1/1] FROM docker.io/nixos/nix:2.10.3@sha256:c6c9e6bf8d2d  0.0s
 => CACHED [builder 1/6] WORKDIR /scratch                                  0.0s
 => CACHED [builder 2/6] COPY --link ./.devbox/gen/default.nix ./.devbox/  0.0s
 => ERROR [builder 3/6] RUN --mount=type=cache,target=/nix/store,from=ba  41.9s
------                                                                          
 > [builder 3/6] RUN --mount=type=cache,target=/nix/store,from=base,source=/nix/store   nix-env -if ./.devbox/gen/default.nix:                                  
#0 0.182 + nix-env -if ./.devbox/gen/default.nix                                
#0 14.85 installing 'devbox'                                                    
#0 15.54 these 2 derivations will be built:
#0 15.54   /nix/store/wq88c0agyqhma7znmrp655cws597br7m-builder.pl.drv
#0 15.54   /nix/store/in60a41sd57hvcdnz7i5nh2v6j3yqjp3-devbox.drv
#0 15.54 these 63 paths will be fetched (268.86 MiB download, 1706.88 MiB unpacked):
#0 15.54   /nix/store/061mgadrs6f4fnig5lgr5jpan2grhw24-gcc-9.5.0-lib
#0 15.54   /nix/store/0dkrr57b6akl039svgppsacbwwad3dip-ed-1.18
#0 15.54   /nix/store/0pybhdgg00x8pmq8jy2jjdlz1ld6w538-ncurses-6.3-p20220507-dev
#0 15.54   /nix/store/0rvrid3zvjcdn33685f4d3qncwiajnrh-bash-5.1-p16
#0 15.54   /nix/store/3a7sdmh9hwzkwww346dfwxcw2q793ram-diffutils-3.8
#0 15.54   /nix/store/3c9mv9c361chjz4x9g19x0k8fp2hnbh0-ncurses-6.3-p20220507-man
#0 15.54   /nix/store/3qkvk76zfcdh2pw8d8wb2dsw6yqicdby-brotli-1.0.9-lib
#0 15.54   /nix/store/450zz8z1vhb0mhmjvqg0ngvk7p2njzpx-gnugrep-3.7
#0 15.54   /nix/store/48xvsfhmfixskfpazgvwn4xjgbayi1z4-gnutar-1.34
#0 15.54   /nix/store/4m0ql1nd3kahkcj9ah1s78pc689mfmhf-binutils-2.38
#0 15.54   /nix/store/5rz4lxl3lbsagss3gp184yfk28zfjvxw-rustc-1.62.1
#0 15.54   /nix/store/7838y8gxbkw2w4h1z7hpzbvl3x447h11-rustup-1.25.1
#0 15.54   /nix/store/7dl4gslywh9ph6w9s5ha69zwns7k6mc0-keyutils-1.6.3-lib
#0 15.54   /nix/store/7mjrrj68fz00x7im4nkjv6sc298fqq95-coreutils-9.1
#0 15.54   /nix/store/7px22xv83ibbn01r14j00zhi9ihxzq2m-openssl-1.1.1q
#0 15.54   /nix/store/7wgf5xwn7higdzfjcp48kam81whlvbvm-llvm-14.0.6-lib
#0 15.54   /nix/store/8nz4rylkp7cj7rh13bcmx0af35vd894c-rust-analyzer-unwrapped-2022-08-01
#0 15.54   /nix/store/8yhsxwjx9d2ps1hfkmzaqvik3a40ma56-acl-2.3.1
#0 15.54   /nix/store/ak6g0ddib4s22jij3iqdmqwhrn1dkv0b-xz-5.2.5
#0 15.54   /nix/store/avnsbf9d3m8dqynvlzhda5p7rl3fbnhi-gzip-1.12
#0 15.54   /nix/store/bcjvqh43fwfihiscaz56s3hq939fxvna-libkrb5-1.20
#0 15.54   /nix/store/bsr7p3k5yv19km30692ck6mmmq1vx0n7-nss-cacert-3.80
#0 15.54   /nix/store/c61z5409smzwagkhiv1d3fb6hxkr62g3-file-5.42
#0 15.54   /nix/store/dcs3ab4xc0g015p0gwmgx9f6g0899scz-xz-5.2.5-bin
#0 15.54   /nix/store/dliyywvc00777zbkcgql80h7c8pxscaa-nghttp2-1.47.0-lib
#0 15.54   /nix/store/dqrndqjk2iry9r2m0n5sls7wdiavwl7b-rustfmt-1.62.1
#0 15.54   /nix/store/fzmbbpjz0gpnbmhfdzfx8an06qhh7iby-glibc-2.35-163-dev
#0 15.54   /nix/store/gacj9q1w5vc50ayqxhbv2q1dbjq0xvz1-rust-analyzer-2022-08-01
#0 15.54   /nix/store/gmnikjmndd25ida53l51gqhw4kwadcdx-patch-2.7.6
#0 15.54   /nix/store/gwdnzcqy8vr3hj09j7iapc044irq2wjb-stdenv-linux
#0 15.54   /nix/store/hd8vccnsxd5y01bc5spwh2x06vdx744z-clippy-1.62.1
#0 15.54   /nix/store/hxa4ya7kxgbq58aj85ni4q3y4g9rkwl6-libunistring-1.0
#0 15.54   /nix/store/il2mpl6qjc4aa42mbiy3p3wicm3d6nz5-glibc-2.35-163
#0 15.54   /nix/store/jj9ypmp0hpx2jy67niq6n4a7mi16mzd3-gawk-5.1.1
#0 15.54   /nix/store/kd2gnnfgnfvwg3p5zigwdn3y4zyvqvna-llvm-14.0.6-dev
#0 15.54   /nix/store/kzprvb6hqs0l5mnc2z9k8fm8ykky95yd-gmp-with-cxx-stage4-6.2.1
#0 15.54   /nix/store/l4fqm8z2yqp96r2zbc5bn5g1qa66b6qq-bzip2-1.0.8-bin
#0 15.54   /nix/store/lbws1ffvymjs50wa81v299b3cb5hygvz-attr-2.5.1
#0 15.54   /nix/store/lpyi5vily5xs2a33135yn7pcx973blxk-cargo-1.62.1
#0 15.54   /nix/store/mfaqdvnq9wbg4yaynmqvly8fdcknivin-zlib-1.2.12
#0 15.54   /nix/store/mjjqdygchm7ykjvgj06ljx4qwma08l2b-zlib-1.2.12-dev
#0 15.54   /nix/store/nln9q1q55z0cd8aw57vi0l10j1prgqsk-patchelf-0.14.5
#0 15.54   /nix/store/npv5jhnjamp5c179pyd33ygbr76kip0m-curl-7.84.0
#0 15.54   /nix/store/phfk6x9z5cq6w2li05pn1h7qv63kd7r8-pcre-8.45
#0 15.54   /nix/store/q6zwhzg0nw283anjx81cgy8an0gibca0-linux-headers-5.18
#0 15.54   /nix/store/qxy4b3fv62sik3vys444pjn74n94h5g5-libidn2-2.3.2
#0 15.55   /nix/store/r2qx8np9pa75m35mnzid1bvq6nvz5hn0-perl-5.34.1
#0 15.55   /nix/store/rm0545m3qqv5345vazsn6af71zbjfmi0-glibc-iconv-2.35
#0 15.55   /nix/store/s5v02qzrl5jrvadcs9mcc2z3rddss1wk-libffi-3.4.2
#0 15.55   /nix/store/s9x16skrq8f9ykzrxysa98c06q3q9z1k-findutils-4.9.0
#0 15.55   /nix/store/snhxfl9qygg4nh0bh22k56wzxkri2sg4-libxml2-2.9.14
#0 15.55   /nix/store/v5kjnvn4jh93x83g4z3wfrnazip7k2l9-bzip2-1.0.8
#0 15.55   /nix/store/vadcsn6vbv2nqsch1wch4ih3xvh8jhci-hook
#0 15.55   /nix/store/vfndbx1ylzlr660bgm48222bsplyp0hs-gnused-4.8
#0 15.55   /nix/store/vy6njjxawyqml42lpa0w7lird8j3bgwr-llvm-14.0.6
#0 15.55   /nix/store/xc2hsb276dm7qg52psilhfb5rax8w1z9-rustc-1.62.1-man
#0 15.55   /nix/store/xm5p94wz8m7a665nmr26fyj667amv9rb-zstd-1.5.2
#0 15.55   /nix/store/xr3264bc5g199l5bvfyrlkq0wmh7l4j6-rust-lib-src
#0 15.55   /nix/store/xrcvvcp3vwbr0gif0g024wmb938xzqhq-glibc-2.35-163-bin
#0 15.55   /nix/store/xxz2b1zqpij9j95wlf4j3y1ghqdhpqhk-gnu-config-2021-01-25
#0 15.55   /nix/store/yaikhg6vn6hikb9fg01dfy082z52im7h-gnumake-4.3
#0 15.55   /nix/store/yazhmh9bm781kpfa7xp9rygwa3mdfnk2-ncurses-6.3-p20220507
#0 15.55   /nix/store/yjn4q5mb6zmm50722p05s47irplaa2bn-libssh2-1.10.0
#0 15.55 copying path '/nix/store/xc2hsb276dm7qg52psilhfb5rax8w1z9-rustc-1.62.1-man' from 'https://cache.nixos.org'...
#0 15.57 copying path '/nix/store/xxz2b1zqpij9j95wlf4j3y1ghqdhpqhk-gnu-config-2021-01-25' from 'https://cache.nixos.org'...
#0 15.59 copying path '/nix/store/hxa4ya7kxgbq58aj85ni4q3y4g9rkwl6-libunistring-1.0' from 'https://cache.nixos.org'...
#0 15.67 copying path '/nix/store/vadcsn6vbv2nqsch1wch4ih3xvh8jhci-hook' from 'https://cache.nixos.org'...
#0 15.69 copying path '/nix/store/qxy4b3fv62sik3vys444pjn74n94h5g5-libidn2-2.3.2' from 'https://cache.nixos.org'...
#0 15.72 copying path '/nix/store/q6zwhzg0nw283anjx81cgy8an0gibca0-linux-headers-5.18' from 'https://cache.nixos.org'...
#0 15.93 copying path '/nix/store/il2mpl6qjc4aa42mbiy3p3wicm3d6nz5-glibc-2.35-163' from 'https://cache.nixos.org'...
#0 16.51 copying path '/nix/store/3c9mv9c361chjz4x9g19x0k8fp2hnbh0-ncurses-6.3-p20220507-man' from 'https://cache.nixos.org'...
#0 16.60 copying path '/nix/store/lbws1ffvymjs50wa81v299b3cb5hygvz-attr-2.5.1' from 'https://cache.nixos.org'...
#0 16.63 copying path '/nix/store/0rvrid3zvjcdn33685f4d3qncwiajnrh-bash-5.1-p16' from 'https://cache.nixos.org'...
#0 16.68 copying path '/nix/store/8yhsxwjx9d2ps1hfkmzaqvik3a40ma56-acl-2.3.1' from 'https://cache.nixos.org'...
#0 16.70 copying path '/nix/store/3qkvk76zfcdh2pw8d8wb2dsw6yqicdby-brotli-1.0.9-lib' from 'https://cache.nixos.org'...
#0 16.74 copying path '/nix/store/v5kjnvn4jh93x83g4z3wfrnazip7k2l9-bzip2-1.0.8' from 'https://cache.nixos.org'...
#0 16.77 copying path '/nix/store/0dkrr57b6akl039svgppsacbwwad3dip-ed-1.18' from 'https://cache.nixos.org'...
#0 16.79 copying path '/nix/store/l4fqm8z2yqp96r2zbc5bn5g1qa66b6qq-bzip2-1.0.8-bin' from 'https://cache.nixos.org'...
#0 16.84 copying path '/nix/store/jj9ypmp0hpx2jy67niq6n4a7mi16mzd3-gawk-5.1.1' from 'https://cache.nixos.org'...
#0 16.92 copying path '/nix/store/xrcvvcp3vwbr0gif0g024wmb938xzqhq-glibc-2.35-163-bin' from 'https://cache.nixos.org'...
#0 17.02 copying path '/nix/store/yaikhg6vn6hikb9fg01dfy082z52im7h-gnumake-4.3' from 'https://cache.nixos.org'...
#0 17.08 copying path '/nix/store/fzmbbpjz0gpnbmhfdzfx8an06qhh7iby-glibc-2.35-163-dev' from 'https://cache.nixos.org'...
#0 17.18 copying path '/nix/store/vfndbx1ylzlr660bgm48222bsplyp0hs-gnused-4.8' from 'https://cache.nixos.org'...
#0 17.24 copying path '/nix/store/061mgadrs6f4fnig5lgr5jpan2grhw24-gcc-9.5.0-lib' from 'https://cache.nixos.org'...
#0 17.39 copying path '/nix/store/rm0545m3qqv5345vazsn6af71zbjfmi0-glibc-iconv-2.35' from 'https://cache.nixos.org'...
#0 17.41 copying path '/nix/store/kzprvb6hqs0l5mnc2z9k8fm8ykky95yd-gmp-with-cxx-stage4-6.2.1' from 'https://cache.nixos.org'...
#0 17.46 copying path '/nix/store/48xvsfhmfixskfpazgvwn4xjgbayi1z4-gnutar-1.34' from 'https://cache.nixos.org'...
#0 17.52 copying path '/nix/store/7mjrrj68fz00x7im4nkjv6sc298fqq95-coreutils-9.1' from 'https://cache.nixos.org'...
#0 17.59 copying path '/nix/store/avnsbf9d3m8dqynvlzhda5p7rl3fbnhi-gzip-1.12' from 'https://cache.nixos.org'...
#0 17.61 copying path '/nix/store/3a7sdmh9hwzkwww346dfwxcw2q793ram-diffutils-3.8' from 'https://cache.nixos.org'...
#0 17.67 copying path '/nix/store/s9x16skrq8f9ykzrxysa98c06q3q9z1k-findutils-4.9.0' from 'https://cache.nixos.org'...
#0 17.74 copying path '/nix/store/7dl4gslywh9ph6w9s5ha69zwns7k6mc0-keyutils-1.6.3-lib' from 'https://cache.nixos.org'...
#0 17.76 copying path '/nix/store/s5v02qzrl5jrvadcs9mcc2z3rddss1wk-libffi-3.4.2' from 'https://cache.nixos.org'...
#0 17.78 copying path '/nix/store/bcjvqh43fwfihiscaz56s3hq939fxvna-libkrb5-1.20' from 'https://cache.nixos.org'...
#0 17.89 copying path '/nix/store/yazhmh9bm781kpfa7xp9rygwa3mdfnk2-ncurses-6.3-p20220507' from 'https://cache.nixos.org'...
#0 18.07 copying path '/nix/store/dliyywvc00777zbkcgql80h7c8pxscaa-nghttp2-1.47.0-lib' from 'https://cache.nixos.org'...
#0 18.10 copying path '/nix/store/bsr7p3k5yv19km30692ck6mmmq1vx0n7-nss-cacert-3.80' from 'https://cache.nixos.org'...
#0 18.13 copying path '/nix/store/7px22xv83ibbn01r14j00zhi9ihxzq2m-openssl-1.1.1q' from 'https://cache.nixos.org'...
#0 18.29 copying path '/nix/store/gmnikjmndd25ida53l51gqhw4kwadcdx-patch-2.7.6' from 'https://cache.nixos.org'...
#0 18.32 copying path '/nix/store/nln9q1q55z0cd8aw57vi0l10j1prgqsk-patchelf-0.14.5' from 'https://cache.nixos.org'...
#0 18.35 copying path '/nix/store/phfk6x9z5cq6w2li05pn1h7qv63kd7r8-pcre-8.45' from 'https://cache.nixos.org'...
#0 18.39 copying path '/nix/store/8nz4rylkp7cj7rh13bcmx0af35vd894c-rust-analyzer-unwrapped-2022-08-01' from 'https://cache.nixos.org'...
#0 19.01 copying path '/nix/store/450zz8z1vhb0mhmjvqg0ngvk7p2njzpx-gnugrep-3.7' from 'https://cache.nixos.org'...
#0 19.06 copying path '/nix/store/xr3264bc5g199l5bvfyrlkq0wmh7l4j6-rust-lib-src' from 'https://cache.nixos.org'...
#0 19.47 copying path '/nix/store/dqrndqjk2iry9r2m0n5sls7wdiavwl7b-rustfmt-1.62.1' from 'https://cache.nixos.org'...
#0 19.89 copying path '/nix/store/gacj9q1w5vc50ayqxhbv2q1dbjq0xvz1-rust-analyzer-2022-08-01' from 'https://cache.nixos.org'...
#0 19.91 copying path '/nix/store/ak6g0ddib4s22jij3iqdmqwhrn1dkv0b-xz-5.2.5' from 'https://cache.nixos.org'...
#0 19.95 copying path '/nix/store/mfaqdvnq9wbg4yaynmqvly8fdcknivin-zlib-1.2.12' from 'https://cache.nixos.org'...
#0 19.99 copying path '/nix/store/dcs3ab4xc0g015p0gwmgx9f6g0899scz-xz-5.2.5-bin' from 'https://cache.nixos.org'...
#0 20.01 copying path '/nix/store/4m0ql1nd3kahkcj9ah1s78pc689mfmhf-binutils-2.38' from 'https://cache.nixos.org'...
#0 20.45 copying path '/nix/store/c61z5409smzwagkhiv1d3fb6hxkr62g3-file-5.42' from 'https://cache.nixos.org'...
#0 20.52 copying path '/nix/store/yjn4q5mb6zmm50722p05s47irplaa2bn-libssh2-1.10.0' from 'https://cache.nixos.org'...
#0 20.54 copying path '/nix/store/snhxfl9qygg4nh0bh22k56wzxkri2sg4-libxml2-2.9.14' from 'https://cache.nixos.org'...
#0 20.60 copying path '/nix/store/0pybhdgg00x8pmq8jy2jjdlz1ld6w538-ncurses-6.3-p20220507-dev' from 'https://cache.nixos.org'...
#0 20.62 copying path '/nix/store/7wgf5xwn7higdzfjcp48kam81whlvbvm-llvm-14.0.6-lib' from 'https://cache.nixos.org'...
#0 25.51 copying path '/nix/store/r2qx8np9pa75m35mnzid1bvq6nvz5hn0-perl-5.34.1' from 'https://cache.nixos.org'...
#0 26.29 copying path '/nix/store/vy6njjxawyqml42lpa0w7lird8j3bgwr-llvm-14.0.6' from 'https://cache.nixos.org'...
#0 27.38 copying path '/nix/store/gwdnzcqy8vr3hj09j7iapc044irq2wjb-stdenv-linux' from 'https://cache.nixos.org'...
#0 27.40 copying path '/nix/store/mjjqdygchm7ykjvgj06ljx4qwma08l2b-zlib-1.2.12-dev' from 'https://cache.nixos.org'...
#0 27.43 copying path '/nix/store/xm5p94wz8m7a665nmr26fyj667amv9rb-zstd-1.5.2' from 'https://cache.nixos.org'...
#0 27.49 copying path '/nix/store/kd2gnnfgnfvwg3p5zigwdn3y4zyvqvna-llvm-14.0.6-dev' from 'https://cache.nixos.org'...
#0 27.86 copying path '/nix/store/npv5jhnjamp5c179pyd33ygbr76kip0m-curl-7.84.0' from 'https://cache.nixos.org'...
#0 27.90 copying path '/nix/store/5rz4lxl3lbsagss3gp184yfk28zfjvxw-rustc-1.62.1' from 'https://cache.nixos.org'...
#0 40.22 copying path '/nix/store/7838y8gxbkw2w4h1z7hpzbvl3x447h11-rustup-1.25.1' from 'https://cache.nixos.org'...
#0 40.44 copying path '/nix/store/lpyi5vily5xs2a33135yn7pcx973blxk-cargo-1.62.1' from 'https://cache.nixos.org'...
#0 40.78 copying path '/nix/store/hd8vccnsxd5y01bc5spwh2x06vdx744z-clippy-1.62.1' from 'https://cache.nixos.org'...
#0 40.98 building '/nix/store/wq88c0agyqhma7znmrp655cws597br7m-builder.pl.drv'...
#0 41.03 building '/nix/store/in60a41sd57hvcdnz7i5nh2v6j3yqjp3-devbox.drv'...
#0 41.07 error: collision between `/nix/store/7838y8gxbkw2w4h1z7hpzbvl3x447h11-rustup-1.25.1/bin/rustfmt' and `/nix/store/dqrndqjk2iry9r2m0n5sls7wdiavwl7b-rustfmt-1.62.1/bin/rustfmt'
#0 41.10 error: builder for '/nix/store/in60a41sd57hvcdnz7i5nh2v6j3yqjp3-devbox.drv' failed with exit code 25
------
error: failed to solve: executor failed running [/bin/sh -eux -o pipefail -c nix-env -if ./.devbox/gen/default.nix]: exit code: 100
Error: exit status 1

Rename the file to `.devbox.json`

This is a bit of a personal choice and OCD, but I don't like files scattered about the root of my repo. The situation would be a bit better if the file were hidden, so I'd like to propose that the file be renamed to .devbox.json.

devbox shell changes locale `LC_CTYPE` to `C`

Thanks for creating Devbox. It's got potential!

While testing it out, I ran into the following issue: on macOS Monterey devbox shell changes my LC_CTYPE from "UTF-8" to "C". This is causing me trouble with code that has Unicode (non-ASCII) characters.

It looks like that @rdlu #17 (comment) already ran into a very similar issue:

When I check locale from my shell it's indeed showing en_US.UTF-8 (my "real" shell), but when I run the iex (similar to ipython or irb), I see that the locale is not really UTF8. This is potentially another issue for my code.

It would be great if, instead of setting locale env vars to C, devbox shell could automatically "import" my current vars into it.

An alternative, temporary workaround are shell hooks (#42, #45). That would at least make setting env variables easier (e.g. export LC_CTYPE=UTF-8 on init).


The issue:

$ devbox version
0.0.4

$ devbox shell
...

# the error I originally ran into:
$ bundle install

[!] There was an error while loading `example.gemspec`: invalid byte sequence in US-ASCII. Bundler cannot continue.
...

# this fixes the error:
$ LC_CTYPE=UTF-8 bundle install
...

My locale on zsh (outside devbox shell) is:

$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

# the above most likely is the default on macOS
# I am not changing/exporting anything related to locale in `.zshrc`, `.zprofile`, etc
# see also: https://swi-prolog.discourse.group/t/default-locale-and-encoding-settings-on-macos/4974

On a devbox shell:

$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

mktemp: too few X's in template ‘devbox

Steps to reproduce on macOS

$ curl -fsSL https://get.jetpack.io/devbox | bash
$ devbox init                                                                                                                           
mktemp: too few X's in template ‘devbox’
→ Downloading version 0.0.2...
✘ Command failed (exit code 23): curl --fail --silent --location --output /devbox_0.0.2_darwin_arm64.tar.gz https://github.com/jetpack-io/devbox/releases/download/0.0.2/devbox_0.0.2_darwin_arm64.tar.gz

Devbox shell PATH should take precedence over existing binaries

Hey!

Just been testing devbox and the experience so far is really smooth. I stumbled upon 3 things that confused me:

  1. devbox add package failed with Package not found until I opened a new terminal. It's kind of documented, but maybe there is a way for a better error? Anyway, that's a nit.
  2. devbox shell first run can take quite some time and there is no progress bar, but we already have #7
  3. Which is this issue really about.

It seems the initial run of devbox shell does not spawn the shell, instead it exists once it completes package initialization. Here's the terminal log that shows the issue:

lucjansuski@MacBook-Pro-3 ~ % cd /tmp
lucjansuski@MacBook-Pro-3 /tmp % mkdir test
lucjansuski@MacBook-Pro-3 /tmp % cd test
lucjansuski@MacBook-Pro-3 test % devbox init
lucjansuski@MacBook-Pro-3 test % devbox add python
lucjansuski@MacBook-Pro-3 test % devbox shell
this path will be fetched (7.93 MiB download, 49.47 MiB unpacked):
  /nix/store/3j1bsklak6p752nhys18n0p9i3grq1bz-python-2.7.18
copying path '/nix/store/3j1bsklak6p752nhys18n0p9i3grq1bz-python-2.7.18' from 'https://cache.nixos.org'...
Starting a devbox shell...
lucjansuski@MacBook-Pro-3 test % which python
/Users/lucjansuski/.asdf/shims/python
lucjansuski@MacBook-Pro-3 test % devbox shell
Starting a devbox shell...
MacBook-Pro-3:test lucjansuski$ which python
/nix/store/3j1bsklak6p752nhys18n0p9i3grq1bz-python-2.7.18/bin/python
MacBook-Pro-3:test lucjansuski$

I'm on macOS Monterey 12.5.

Implement Podman support

Podman can be used as a (rootless and rootfull) drop-in replacement for Docker. Some users would like to take advantage of this, mainly on systems where the root filesystem is immutable and/or it is not beneficial to have both Docker and Podman installed.

All that would be required to support Podman afaik would be checking for a podman command and then using that if available (and possibly configurable in a configuration file and/or the CLI.)

Users can additionally work around this limitation of devbox by making either 1. an alias for Docker to pass to Podman, or 2. make a file in /usr/bin/ named docker that redirects to Podman. However, this isn't ideal, and it would most likely be trivial to implement support for Podman in the program itself.

I would love to help to implement this myself, however, I am inexperienced in Go, so I don't want to go tinkering where I shouldn't.

Workflow: Devbox Run

Current State

If you want to run a one off command or package with Devbox, you currently need to start your shell, run your package, and then exit the shell. This adds a lot of steps and friction for developers who may want to quickly start a package or run a project in their shell

Desired State

I set up a shell in advance with devbox init, and then add packages usingdevbox add. I now want to run a specific command or script in my Devbox Shell and then exit back to my normal shell, so I invoke my script or command with the Devbox CLI. This would be used to run my script in an isolated shell with all it’s dependencies, display the results, and then exit the Devbox shell.

Devbox Add API Error

Hello. Anytime I run devbox add PACKAGE I get this error:

segment 2022/09/03 12:09:56 ERROR: sending request - Post "https://api.segment.io/v1/batch": dial tcp: lookup api.segment.io on 100.64.0.7:53: no such host
segment 2022/09/03 12:09:56 ERROR: 1 messages dropped because they failed to be sent and the client was closed

But the package is still added to the json file. It only started today (2022-09-03). I first installed and tried out devbox earlier this week and didn't see that message. I'm on Ubuntu 20.04.

devbox shell gives no indication

When I start a devbox shell I see no visual indication that I'm in the shell, but it definitely is working

image

# type lazygit
lazygit is hashed (/nix/store/alnmpxx1njfnv671sgnqxrws1bbari6r-lazygit-0.35/bin/lazygit)

# echo $PS1
\n\d \t\n\e[37;44m[\u@\h:\w]\[\e[00m\] \[\e[91m\]$(parse_git_branch)\[\e[00m\]\n#

# type parse_git_branch
parse_git_branch is a function
parse_git_branch ()
{
    git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}

Allow setting ENV and other custom scripts on shell start

On shell start, I want to set some ENV variables and configure some other things. For example, I want to set some personal aws credentials, or kube configs.

Would be great if I can set a hook to run a script of my choice on devbox shell.

docs fix idea: example of devbox.json

Just spent time reviewing this. I expected to be able to see what a devbox.json file looks like.

I found this:

Initialize Devbox:
devbox init
This creates devbox.json. You should commit this file.

I can do this, but it seems like the docs should have an example devbox.json front and center since that's the artifact people work with.

Hope this helps! Cool idea. :)

Q: Support for multiple devbox environments?

Is it possible to have different environments with different shells? I move to a different directory and create a new devbox.json but running devbox shell still contains the installed packages from the original devbox.json.

Perhaps this is a question pertinent only to Rust? I installed Clojure via one of the shells and it didn't show in the other shell.

Edit: Okay, I think I have it sorted, but perhaps some clarification on how it works?

Allow overwrites on install, build and start command

Right now devbox plan does automatic language detection and sets the install, build and start commands. But it only supports Golang for now.

I'd like to try it on a python project and build a container with it. Would love to see those three fields being exposed in devbox.json so someone can go ahead and modify them. Thoughts?

devbox add ghc && devbox add haskellPackages.aeson does not add aeson to ghc package database

$ devbox add ghc
$ devbox add haskellPackages.aeson
$ devbox shell
$ ghc-pkg list | grep aeson

That should show a package listed. Compare to the nix equivalent:

$ ghc-pkg list | grep aeson
    aeson-1.5.6.0

This lets it be used by ghci for instance:

$ ghci 
GHCi, version 8.10.7: https://www.haskell.org/ghc/  :? for help
Prelude> import Data.Aeson
Prelude Data.Aeson> :t parseJSON
parseJSON
  :: FromJSON a =>
     Value -> aeson-1.5.6.0:Data.Aeson.Types.Internal.Parser a

I kind of expected this not to work, but figured I'd make an issue since I think it'd be nice if people could do this. Especially for things like the lens library with tons of dependencies which really make use of binary caching.

Nested `devbox shell` calls should issue a warning

After starting a shell with devbox shell it's easy to forget that you're already inside a devbox, and you might end up calling devbox shell again. Devbox should detect that it's already controlling the shell and issue a warning.

Shell is not overridden on MacOS

Hi,

I've install Nix, followed by Devbox, upon trying to do a devbox add nodejs-18_x followed by a devbox shell - I get dropped into a new zsh shell but has no access to node 18, it has access to node 16 from my main env.

Have I missed something or have I stumbled upon a bug? is there anything I can do to debug?

disclaimer: I had previously installed nix about a year back and didn't do too much with it.

Thanks

Language Support: Support installing python packages with pip in Devbox shell

Current State

Installing Python packages in Devbox shell with pip is currently not supported, since pip's global installation process conflicts with the Nix store. Developers can currently use Poetry to install packages in Devbox, since Poetry automatically creates a virtual environment that can install packages in an isolated fashion. However, since pip is still an incredibly popular package manager for Python, we should support it as well.

Desired State

Users should have an intuitive way to install packages using Pip in Devbox Shell, and when building images with Devbox Build. The process we work out for supporting pip should also influence how we support other package managers that can install packages globally, such as bundler and npm

Specify package versions

Hi, currently it is not clear how to install a specific package version for example for nodejs 16 instead of the latest 18 which is the version for the nodejs nix package. Is there a way to do this? This seems to be a must-have thing for dev environments. After some research, this tool came up, which feels like more of a workaround...

Nevertheless, thanks for the tool!

Installing python packages in devbox

Hi,

Following the quickstart, I have installed python 3.10 in the devbox environment. However, how do I install python packages in the environment? A pip install tells me that the package is already installed. But that installation actually belongs to the installation in my WSL environment itself, and not in the devbox environment.

(base) weiann@Surface-Laptop:/mnt/c/Users/wei-a/Documents/code/github/devbox/quickstart$ python --version
Python 3.8.8
(base) weiann@Surface-Laptop:/mnt/c/Users/wei-a/Documents/code/github/devbox/quickstart$ devbox shell
Installing nix packages. This may take a while...
Starting a devbox shell...
(base) weiann@Surface-Laptop:/mnt/c/Users/wei-a/Documents/code/github/devbox/quickstart$ python --version
Python 3.10.5
(base) weiann@Surface-Laptop:/mnt/c/Users/wei-a/Documents/code/github/devbox/quickstart$ pip install pandas
Requirement already satisfied: pandas in /home/weiann/anaconda3/lib/python3.8/site-packages (1.2.4)
Requirement already satisfied: python-dateutil>=2.7.3 in /home/weiann/anaconda3/lib/python3.8/site-packages (from pandas) (2.8.1)
Requirement already satisfied: pytz>=2017.3 in /home/weiann/anaconda3/lib/python3.8/site-packages (from pandas) (2021.1)
Requirement already satisfied: numpy>=1.16.5 in /home/weiann/anaconda3/lib/python3.8/site-packages (from pandas) (1.20.1)
Requirement already satisfied: six>=1.5 in /home/weiann/anaconda3/lib/python3.8/site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)

Devbox build unable to handle different versions of Go

Issue

When adding go_1_19 to my projects Devbox configuration, the devbox build command fails with the error

#0 38.04 error: collision between `/nix/store/i0rdvlkvc5sz0dr87s379j0i4xmnwrp5-go-1.18.4/bin/go' and `/nix/store/w205lbrnh8cm9680pqzw2pc07rhi43an-go-1.19/bin/go'
#0 38.15 error: builder for '/nix/store/9vrr8h6l7n1gjrl8ybb24qrvpbirvd33-devbox.drv' failed with exit code 25
------
error: failed to solve: executor failed running [/bin/sh -eux -o pipefail -c nix-env -if ./.devbox/gen/default.nix]: exit code: 100

Expected Result

A devbox container image that includes Go version 1.19

Additional Information

I dug into the code a bit and the issue is being caused by the language detection feature for Go. The Go planner builder does not contain any logic for detecting that a golang nix package has already been requested which results in both the go_1_19 and go Nix packages being added to the list of packages used for populating the default.nix and shell.nix template files.

Contents of devbox.json

{
  "packages": [
    "go_1_19"
  ]
}

Generated default.nix

let
  pkgs = import (fetchTarball {
    # Commit hash as of 2022-08-16
    # `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
    url = "https://github.com/nixos/nixpkgs/archive/af9e00071d0971eb292fd5abef334e66eda3cb69.tar.gz";
    sha256 = "1mdwy0419m5i9ss6s5frbhgzgyccbwycxm5nal40c8486bai0hwy";
  }) {};
in with pkgs;
buildEnv {
  name = "devbox";
  paths = [
    go_1_19
  
    go
  ];
  pathsToLink = [ "/bin" ];
}

Generated shell.nix

let
  pkgs = import (fetchTarball {
    # Commit hash as of 2022-08-16
    # `git ls-remote https://github.com/nixos/nixpkgs nixos-unstable`
    url = "https://github.com/nixos/nixpkgs/archive/af9e00071d0971eb292fd5abef334e66eda3cb69.tar.gz";
    sha256 = "1mdwy0419m5i9ss6s5frbhgzgyccbwycxm5nal40c8486bai0hwy";
  }) {};
in with pkgs;
mkShell {
  shellHook =
    ''
      echo "Starting a devbox shell..."
      export name="devbox"
      export IN_NIX_SHELL=0
      export DEVBOX_SHELL_ENABLED=1
    '';
  packages = [
    go_1_19
  
    go
  ];
}

Possible Solutions

I started poking around at a solution for handling this and at first I was going to just add a check in the Go planner's IsRelevant() method when I realized that this problem will not be limited to just Golang. I can think of 2 different methods for addressing this:

  1. Modify the Planner interface in a way that forwards user-specified packages to each languages Planner in a way that allows it to create it's build plan using the user-specified language version and removing that entry from the user-specified packages list
  2. Implement language version detection in each planner (ie. parsing go.mod/pyproject.toml for versions) and add collision checking for user-specified packages elsewhere.

I figured I'd forgo sending in a PR since this probably warrants a discussion before deciding on how this situation is handled.

devbox shell wrapper fails when mktemp is installed in nix profile

On an M1 mac with nix, my nix profile already has mktemp installed. The devbox shell wrapper is assuming the non-gnu version of mktemp, and fails with the cryptic error:

❯ devbox init
mktemp: too few X's in template ‘devbox’
→ Downloading version 0.0.2...
✘ Command failed (exit code 23): curl --fail --silent --location --output /devbox_0.0.2_darwin_arm64.tar.gz https://github.com/jetpack-io/devbox/releases/download/0.0.2/devbox_0.0.2_darwin_arm64.tar.gz

Google led me to a stackexchange answer that seems to be relevant.

I messed with the devbox shell script to try to force it to use the mac mktemp but didn't get far. Wanted to report this in case others had similar troubles.

Language Support: C# support in Devbox 🥺

  • I know C# isn't the most popular language out there, and it makes more sense to add support for JS or Python before C#.
  • But what's the harm in asking 🤷 , since you've written this in the description 😛 : -

Ask for a new Language or contribute one via a Pull Request.

Better error message when `nix` is not installed

Nix is a pre-requisite to using devbox. When missing or not installed properly, devbox add fails with:

Error: Package fddfdf not found.

Which makes it sound like the package does not exist. Improve error message to explain that nix should be installed.

devbox init returns an error on MacOS Monterey

devbox init returns the following error on my macos monterey machine:

/usr/local/bin/devbox: line 225: arch: readonly variable
→ Downloading version 0.0.2...
✘ Command failed (exit code 22): curl --fail --silent --location --output /var/folders/jy/x05wfcss4875qnj729p3drbc0000gn/T/devbox.QFnXgmIe/devbox_0.0.2_darwin_.tar.gz https://github.com/jetpack-io/devbox/releases/download/0.0.2/devbox_0.0.2_darwin_.tar.gz

Support x86/amd64 for building & running containers on arm64

Hi,

I'm not the only developer who recently switch to Apple M1/M2 for developing.

Here my feature request:

Build x86/amd64 container image on arm64 : https://medium.com/geekculture/docker-build-with-mac-m1-d668c802ab96

Run x86/amd64 container image on arm64 :

Why?:
I had some "old" deprecated projects using the node-gyp building process on a node.js project and some dependencies depend on x86/amd64 build process. It'll very interesting feature for me, but maybe other developers(python, go, php) working with specific native dependencies where's the arm64 is not available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.