### Setup and Run Tensorflow App Source: https://github.com/jetify-com/devbox/blob/main/examples/data_science/tensorflow/README.md Follow these steps to set up and run the Tensorflow application. Ensure Devbox is installed, clone the repository, navigate to the directory, start a Devbox shell, and run the main Python script. ```bash git clone https://github.com/jetify-com/devbox.git cd devbox/examples/data_science/tensorflow/ devbox shell python3 main.py ``` -------------------------------- ### Setup Drupal Database Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/drupal/README.md Create the 'devbox_drupal' database and example table using the provided SQL script. This is a prerequisite for Drupal installation. ```bash mysql -u root < setup_db.sql ``` -------------------------------- ### Devbox.json Configuration Example Source: https://github.com/jetify-com/devbox/blob/main/testscripts/run/env.test.txt An example of a devbox.json file demonstrating package installations and environment variable definitions, including variable references and overrides. ```json { "packages": ["nginx@latest"], "env": { "CONFIG_VAR1": "abc", "CONFIG_VAR2": "$DEVBOX_FOO", "CONFIG_VAR3": "${PWD}", "NGINX_CONFDIR": "devbox-json-override" } } ``` -------------------------------- ### Start Minikube and Tail Logs Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/argo-workflows/README.md Use this command to start Minikube and monitor its logs in a local shell. Ensure Docker Desktop is installed on macOS. ```bash devbox run minikube ``` -------------------------------- ### Install All Devbox Packages (`devbox install`) Source: https://context7.com/jetify-com/devbox/llms.txt Installs all packages declared in `devbox.json` into the project's Nix profile without starting a shell. This is useful for CI or post-cloning setup. ```bash # Install all packages from devbox.json devbox install ``` -------------------------------- ### Update Examples Source: https://github.com/jetify-com/devbox/blob/main/devbox.md Builds Devbox and then runs a Go program to update example test scripts. ```shell devbox run build && go run testscripts/testrunner/updater/main.go ``` -------------------------------- ### Verify Installed Tools Source: https://github.com/jetify-com/devbox/blob/main/README.md Once inside the Devbox shell, you can use the installed tools directly. This example verifies the Python version. ```bash python --version ``` -------------------------------- ### Initialize and Start PostgreSQL Database Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/postgres/README.md Steps to initialize the database, start the server, create a database, and connect to it using command-line tools. ```bash initdb ``` ```bash devbox services up ``` ```bash createdb ``` ```bash psql ``` -------------------------------- ### Install Argo Workflows on Minikube Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/argo-workflows/README.md Execute this command to install Argo Workflows on your Minikube instance, following the Argo Quickstart documentation. ```bash devbox run argo-install ``` -------------------------------- ### all.json Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/rm/add-rm.test.txt Example `devbox.json` file listing multiple packages. ```json { "packages": ["hello@latest", "vim@latest", "cowsay@latest", "php@latest"] } ``` -------------------------------- ### Install Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/maelstrom/README.md Install Devbox if you don't already have it. Skip this if you are running on devbox.sh. ```bash curl -s https://get.jetify.com/install.sh | bash ``` -------------------------------- ### Start MySQL Server with DevBox Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/mysql/README.md Use this command to start the MySQL server managed by DevBox. ```bash devbox services up ``` -------------------------------- ### Devbox JSON Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/add_replace.test.txt Example of the devbox.json file after adding a package, showing the installed package and its version. ```json { "packages": [ "go@1.19" ] } ``` -------------------------------- ### Devbox JSON configuration with packages Source: https://github.com/jetify-com/devbox/blob/main/testscripts/rm/manual.test.txt Example of a devbox.json file that includes the 'hello' package. ```json { "packages": ["hello"] } ``` -------------------------------- ### Install Nix Package Manager (Determinate Systems) Source: https://github.com/jetify-com/devbox/blob/main/CONTRIBUTING.md Installs the Nix package manager using the Determinate Systems installer script. This is an alternative method for setting up the environment. ```bash curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install ``` -------------------------------- ### Add Local Flake Packages to Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/flakes/README.md Use 'path:/path/to/flake#output' in devbox.json to install packages from a local flake. This example installs 'php' and 'hello' from 'my-php-flake'. ```json { "packages": [ "path:my-php-flake#php", "path:my-php-flake#hello" ], "shell": { "init_hook": null }, "nixpkgs": { "commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62" } } ``` -------------------------------- ### Add Remote Flake Packages to Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/flakes/README.md Use 'github://#' in devbox.json to install packages from a GitHub repository. This example installs 'hello' from a specific Nixpkgs commit and the default output from 'process-compose'. ```json { "packages": [ "github:nixos/nixpkgs/5233fd2ba76a3accb5aaa999c00509a11fd0793c#hello", "github:F1bonacc1/process-compose" ], "shell": { "init_hook": null }, "nixpkgs": { "commit": "f80ac848e3d6f0c12c52758c0f25c10c97ca3b62" } } ``` -------------------------------- ### Install Drupal and Dependencies Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/drupal/README.md Install Drupal and its dependencies using Composer. The application will be installed in the '/web' directory. Configure your site by visiting 'localhost:8000/autoload'. ```bash composer install ``` -------------------------------- ### Set up MariaDB Database Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/laravel/README.md Start the MariaDB service, create the 'laravel' database, and then stop the service. Use the `-b` flag to run MariaDB in the background. ```bash # Start the MariaDB service devbox services up mariadb -b # Create the database mysql -u root -e "CREATE DATABASE laravel;" # Once you're done, stop the MariaDB service devbox services stop mariadb ``` -------------------------------- ### Devbox Configuration with PHP and Extension Source: https://github.com/jetify-com/devbox/blob/main/testscripts/languages/php.test.txt Example devbox.json configuration specifying PHP and a specific extension. This file defines the packages to be installed in the Devbox environment. ```json { "packages": [ "php@latest", "php83Extensions.ds@latest" ] } ``` -------------------------------- ### Create and Install LAPP Stack Project Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/lapp-stack/README.md Use these commands to create a new project from the LAPP stack template and install its dependencies. ```bash devbox create --template lapp-stack devbox install ``` -------------------------------- ### Install Devbox CLI Source: https://github.com/jetify-com/devbox/blob/main/CONTRIBUTING.md Installs the Devbox CLI using a curl command. This is the first step for setting up the development environment. ```bash curl -fsSL https://get.jetify.com/devbox | bash ``` -------------------------------- ### Run Rails Server Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/rails/README.md After setting up the Devbox shell, navigate to the blog directory and start the Rails server. ```bash cd blog bin/rails server ``` -------------------------------- ### Initialize Gradle Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/java/README.md Use this command to initialize a new Gradle project. Ensure you have JDK and Gradle installed via devbox. ```bash gradle init ``` -------------------------------- ### Run Development Server with Bun Source: https://github.com/jetify-com/devbox/blob/main/examples/development/bun/README.md Start your project in development mode using the 'dev' script, which is typically configured to use Bun. ```bash devbox run dev ``` -------------------------------- ### Install and Verify Package Version Source: https://github.com/jetify-com/devbox/blob/main/testscripts/lockfile/nopaths.txt Use 'devbox run' to execute a command within the Devbox environment and verify the installed package version. This is useful for ensuring specific package versions are correctly installed and accessible. ```bash exec devbox run curl --version | grep -o 'curl\s7\.87\.0' stdout 'curl 7.87.0' ``` -------------------------------- ### Install Devbox CLI Source: https://context7.com/jetify-com/devbox/llms.txt Installs the latest Devbox CLI using a curl script. Verify the installation by checking the version. ```bash # Install Devbox curl -fsSL https://get.jetify.com/devbox | bash # Verify installation devbox version # Output: 0.x.y ``` -------------------------------- ### Execute Script Using Installed Package Source: https://github.com/jetify-com/devbox/blob/main/testscripts/run/script.test.txt Run a script that utilizes a package installed via Devbox. The script calls the 'hello' command with an argument. ```bash exec devbox run hello_with_script stdout 'with script' ``` -------------------------------- ### Install and Tidy Lockfile with Devbox Source: https://context7.com/jetify-com/devbox/llms.txt Installs packages and ensures the lockfile is consistent. Use `--config` to specify a different project directory. ```bash devbox install --tidy-lockfile ``` ```bash devbox install --config ./backend ``` -------------------------------- ### Add Hello Package and Execute Source: https://github.com/jetify-com/devbox/blob/main/testscripts/basic/install_hello.test.txt Adds the 'hello' package to the Devbox project and then attempts to execute it. This verifies the package installation and basic execution. ```bash exec devbox add hello ``` ```bash ! exec hello ``` -------------------------------- ### Start Temporalite Server Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/temporal/README.md Run this command to start the Temporalite server for local development and testing. The WebUI is accessible at localhost:8233 and the server listens on port 7233. ```bash devbox run start-temporal ``` -------------------------------- ### Verify Maelstrom Installation Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/maelstrom/README.md Navigate to the Maelstrom directory and run the executable to verify the installation. ```bash cd maelstrom ./maelstrom ``` -------------------------------- ### Install Global NPM Packages Source: https://github.com/jetify-com/devbox/blob/main/examples/development/nodejs/nodejs-npm/README.md Manage global NPM packages by adding them to the `packages` list in `devbox.json`. This is necessary because the Nix Store is immutable and does not support direct global installations via `npm install --global`. ```json { "packages": [ "nodejs@18", "nodePackages.yalc@latest", "nodePackages.pm2@latest" ] } ``` -------------------------------- ### Verify Successful Installation Source: https://github.com/jetify-com/devbox/blob/main/testscripts/languages/python_patch_old_glibc.test.txt Check the standard output to confirm that `psycopg2` was installed successfully. ```bash stdout 'Successfully installed psycopg2' ``` -------------------------------- ### Install Bun Dependencies Source: https://github.com/jetify-com/devbox/blob/main/examples/development/bun/README.md Run this command within your Devbox environment to install project dependencies using Bun. ```bash devbox run bun install ``` -------------------------------- ### Add and Execute 'hello' Package Source: https://github.com/jetify-com/devbox/blob/main/testscripts/shell/shellenv.test.txt Add the 'hello' package to your Devbox project and then execute it to verify installation. The 'stdout .' command checks the standard output. ```shell exec devbox add hello ! exec hello ! stdout . ``` -------------------------------- ### Add Packages to Devbox (`devbox add`) Source: https://context7.com/jetify-com/devbox/llms.txt Adds Nix packages to `devbox.json` and installs them. Supports pinning versions, platform-specific restrictions, specific Nix outputs, and disabling built-in plugins. The example shows the resulting `devbox.json` excerpt. ```bash # Add a package at its latest version devbox add nodejs # Pin to a specific version devbox add python@3.11 go@1.21 # Add multiple packages, one platform-only devbox add --platform x86_64-linux cuda # Add with specific Nix outputs (e.g., dev headers + runtime) devbox add openssl --outputs out,dev # Allow an insecure package devbox add openssl_1_1 --allow-insecure openssl_1_1 # Disable the built-in plugin for a package devbox add postgresql --disable-plugin # Resulting devbox.json excerpt: # { # "packages": { # "nodejs": "latest", # "python": "3.11", # "go": "1.21", # "openssl": {"version": "latest", "outputs": ["out", "dev"]} # } # } ``` -------------------------------- ### Create and Install Jekyll Project with Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/jekyll/README.md Use these commands to create a new Jekyll project from a template and install its dependencies using Devbox. ```bash devbox create --template jekyll devbox install ``` -------------------------------- ### Devbox Configuration for Package Installation Source: https://github.com/jetify-com/devbox/blob/main/testscripts/lockfile/nopaths.txt The 'devbox.json' file specifies the packages to be installed in the Devbox environment. Ensure the package and its desired version are listed here for installation. ```json { "packages": ["curl@7.87.0"], } ``` -------------------------------- ### cowsay.json Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/rm/add-rm.test.txt Example `devbox.json` file listing only the cowsay package. ```json { "packages": ["cowsay@latest"] } ``` -------------------------------- ### Install psycopg2 with Devbox Run Source: https://github.com/jetify-com/devbox/blob/main/testscripts/languages/python_patch_old_glibc.test.txt Execute `pip install psycopg2==2.9.5` within the `venv` environment managed by `devbox run`. This ensures the package is installed correctly for the test. ```bash exec devbox run venv -- pip install psycopg2==2.9.5 ``` -------------------------------- ### Build Devbox CLI Source: https://github.com/jetify-com/devbox/blob/main/CONTRIBUTING.md Builds the Devbox CLI. If Nix is not installed, Devbox will install it automatically before building. ```bash devbox run build ``` -------------------------------- ### Install Packages in Devbox Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/add_insecure.tst.txt Installs all the packages that have been added to the devbox environment. This command should be run after adding packages. ```bash exec devbox install ``` -------------------------------- ### Create MySQL Database Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/mysql/README.md Execute this command to create a new database using a SQL setup file. Ensure `setup_db.sql` exists and contains your database creation script. ```bash mysql -u root --password="" < setup_db.sql ``` -------------------------------- ### Clone Repository and Build Devbox with Go Source: https://github.com/jetify-com/devbox/blob/main/CONTRIBUTING.md Clones the Devbox repository and builds the Devbox CLI using Go. This is an alternative setup method if Devbox itself cannot be used initially. ```bash git clone https://github.com/jetify-com/devbox.git go.jetify.com/devbox cd go.jetify.com/devbox go build ./cmd/devbox ./devbox run -- echo hello, world ``` -------------------------------- ### Initialize Devbox in Empty Directory Source: https://github.com/jetify-com/devbox/blob/main/testscripts/init/empty.test.txt Executes `devbox init` in a new directory and checks for the creation of `devbox.json`. This is the standard way to start a new Devbox project. ```bash ! exists devbox.json exec devbox init exists devbox.json ``` -------------------------------- ### Devbox.json Configuration Example Source: https://context7.com/jetify-com/devbox/llms.txt This JSON file configures project packages, environment variables, and shell scripts, including service management. ```json { "packages": { "nodejs": "20", "postgresql": "latest", "redis": "latest" }, "env": { "PGPORT": "5433", "REDIS_PORT": "6380" }, "shell": { "init_hook": ["npm install"], "scripts": { "start": ["devbox services start", "npm run dev"], "stop": "devbox services stop" } } } ``` -------------------------------- ### Install Pip and Configure Virtual Environment Source: https://github.com/jetify-com/devbox/blob/main/examples/development/python/pip/README.md Installs pip for a specific Python version and configures Devbox to automatically activate a virtual environment upon shell initialization. The virtual environment is created in the project root by default. ```bash devbox add python3xxPackages.pip ``` ```json { "packages": [ "python310", "python310Packages.pip" ], "shell": { "init_hook": ". $VENV_DIR/bin/activate" } } ``` -------------------------------- ### Activate Virtual Environment and Install Requirements Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/django/README.md Activate the Python virtual environment and install project dependencies using pip. These commands are typically included in the init_hook. ```bash . $VENV_DIR/bin/activate pip install -r requirements.txt ``` -------------------------------- ### Devbox Configuration for Gradle Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/java/gradle/hello-world/README.md Example `devbox.json` for a Gradle project, including `gradle`, `jdk`, and `binutils` packages. ```json { "packages": [ "gradle", "jdk", "binutils" ], "shell": { "init_hook": null } } ``` -------------------------------- ### Verify Package Installation Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/add_platforms_flakeref.test.txt Runs a command within the Devbox environment to verify the installed package version. Ensures the package was added and is accessible. ```bash exec devbox run -- process-compose version stdout '1.87.0' ``` -------------------------------- ### Devbox Lockfile Format Example Source: https://context7.com/jetify-com/devbox/llms.txt This JSONC file pins package versions, Nix store paths, and source information for reproducible development environments. ```jsonc // devbox.lock (example) { "lockfile_version": "1", "nix_pkg_commit_hash_map": { "nixpkgs": "abc123..." }, "packages": { "nodejs@20": { "last_modified": "2024-01-15T10:00:00Z", "resolved": "github:NixOS/nixpkgs/abc123#nodejs_20", "source": "devbox-search", "version": "20.11.0", "systems": { "aarch64-darwin": { "outputs": { "out": "/nix/store/xyz123-nodejs-20.11.0" }, "store_path": "/nix/store/xyz123-nodejs-20.11.0" } } } } } ``` -------------------------------- ### Initialize Devbox and Add Python Package Source: https://github.com/jetify-com/devbox/blob/main/testscripts/plugin/plugin.test.txt Initializes Devbox, adds the Python package, and checks for expected plugin output. This is useful for verifying plugin integration during package installation. ```bash exec devbox init exec devbox add python stderr 'This plugin' ``` -------------------------------- ### Manage MariaDB Service Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/mariadb/README.md Use these commands to start or stop the MariaDB service managed by Devbox. ```bash devbox services start mariadb ``` ```bash devbox services stop mariadb ``` -------------------------------- ### Add JDK and Binutils to Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/development/java/gradle/hello-world/README.md Use this command to install the latest JDK and binutils. You can find other JDK versions by running `devbox search jdk`. ```bash devbox add jdk binutils ``` ```json { "packages": [ "jdk@latest", "binutils@latest" ] } ``` -------------------------------- ### Add Yarn as your Package Manager Source: https://github.com/jetify-com/devbox/blob/main/examples/development/nodejs/nodejs-yarn/README.md Install Yarn alongside NodeJS by adding both to your `devbox.json`. ```json { "packages": [ "nodejs@18", "yarn@latest" ], } ``` -------------------------------- ### Initialize Devbox Project (`devbox init`) Source: https://context7.com/jetify-com/devbox/llms.txt Creates a `devbox.json` configuration file in the current or a specified directory. The output shows the created file structure and provides commands for adding packages or starting a shell. ```bash # Initialize in the current directory devbox init # Initialize in a specific directory devbox init ./my-project # Output: # Created devbox.json in /path/to/my-project # Run `devbox add ` to add packages, or `devbox shell` to start a dev shell. # Resulting devbox.json: # { # "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.x.y/.schema/devbox.schema.json", # "packages": [], # "shell": { # "init_hook": ["echo 'Welcome to devbox!' > /dev/null"], # "scripts": { # "test": ["echo \"Error: no test specified\" && exit 1"] # } # } # } ``` -------------------------------- ### Run Hello Package and Check Output Source: https://github.com/jetify-com/devbox/blob/main/testscripts/basic/install_hello.test.txt Executes the 'hello' package using Devbox and asserts that its standard output matches the expected 'Hello, world!' string. This confirms the package functions correctly. ```bash exec devbox run hello stdout 'Hello, world!' ``` -------------------------------- ### Get Package Info Source: https://github.com/jetify-com/devbox/blob/main/testscripts/info/info.test.txt Use `devbox info` to display information about a specific package. This command requires the package name. ```bash exec devbox init exec devbox info hello stdout 'hello ' ``` ```bash exec devbox init exec devbox info hello@latest stdout 'hello ' ``` -------------------------------- ### Devbox Configuration with Whitespace Paths Source: https://github.com/jetify-com/devbox/blob/main/testscripts/basic/path_whitespace.test.txt Example devbox.json configuration for a project where scripts might interact with files containing spaces. ```json { "packages": ["hello@latest"], "shell": { "scripts": { "test": "touch 'file2 with spaces'" } } } ``` -------------------------------- ### Execute and Verify Global Package Add Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/global_add.test.txt Executes commands to add packages globally using devbox and then verifies their installation by checking their versions. ```bash exec rg --version ``` ```bash exec vim --version ``` ```bash exec devbox global add ripgrep vim ``` ```bash exec devbox global shellenv --recompute ``` ```bash source.path ``` ```bash exec rg --version ``` ```bash exec vim --version ``` -------------------------------- ### Bundler Configuration for Gem Builds Source: https://github.com/jetify-com/devbox/blob/main/examples/development/ruby/README.md Use a `.bundle/config` file to pass specific build configurations or flags to Bundler when installing gems. This example disables LTO for the SASS gem. ```dotenv BUNDLE_BUILD__SASSC: "--disable-lto" ``` -------------------------------- ### Create Database using SQL Script Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/mariadb/README.md Execute this command to create a new database by applying a SQL script. Ensure the script `setup_db.sql` exists in the current directory. ```bash mysql --socket-path=$MYSQL_UNIX_PORT --password='' < setup_db.sql ``` -------------------------------- ### Add Packages to Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/laravel/README.md Install necessary packages like MariaDB, PHP, Node.js, Redis, and Composer using Devbox. This ensures plugins are activated. ```bash devbox add mariadb@latest, php@8.1, nodejs@18, redis@latest, php81Packages.composer@latest ``` -------------------------------- ### Initialize and Add Packages with Devbox Source: https://github.com/jetify-com/devbox/blob/main/testscripts/rm/rm.test.txt Initializes a new Devbox environment and adds the 'hello' and 'vim' packages. This sets up the project for subsequent operations. ```bash exec devbox init exec devbox add hello vim exec devbox run hello stdout 'Hello, world!' ``` -------------------------------- ### Install Maelstrom Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/maelstrom/README.md Install Maelstrom within the Devbox environment. This command installs Maelstrom 0.2.2 into a 'maelstrom' subdirectory. ```bash devbox run install ``` -------------------------------- ### Create and Navigate Project with Whitespace Source: https://github.com/jetify-com/devbox/blob/main/testscripts/basic/path_whitespace.test.txt Demonstrates creating a project directory with spaces in its name and changing into it. ```bash mkdir 'my project' cd 'my project' ``` -------------------------------- ### Configure Python and Pipenv in devbox.json Source: https://github.com/jetify-com/devbox/blob/main/examples/development/python/pipenv/README.md Sets up Python 3.10 and pipenv, configuring an init hook to automatically start the virtual environment when entering `devbox shell`. ```json { "packages": [ "python310", "pipenv" ], "shell": { "init_hook": "pipenv shell" } } ``` -------------------------------- ### Successful Installation Without Cycles Source: https://github.com/jetify-com/devbox/blob/main/testscripts/plugin/plugin.cycle.test.txt When a configuration does not contain circular includes, `devbox install` completes successfully, indicating all packages have been installed. ```bash exec devbox install -c ./no-cycle stderr 'Finished installing packages.' ``` -------------------------------- ### Add JDK and Binutils to Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/java/maven/hello-world/README.md Use this JSON snippet in your `devbox.json` to install the latest JDK and binutils. Find other JDK versions by running `devbox search jdk`. ```json { "packages": [ "jdk@latest", "binutils@latest" ], } ``` -------------------------------- ### Expected Devbox Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/add_platforms_flakeref.test.txt An example of an expected devbox.json after adding a package with platform exclusion. It details the package and its specific configuration, including excluded platforms. ```json { "packages": { "hello": "", "cowsay": "latest", "github:F1bonacc1/process-compose/v1.87.0": { "excluded_platforms": ["armv7l-linux"] } } } ``` -------------------------------- ### Initialize Devbox and Generate direnv .envrc Source: https://github.com/jetify-com/devbox/blob/main/testscripts/generate/direnv-envrcdir-parent.test.txt This snippet demonstrates initializing a devbox, generating a direnv .envrc file in the parent directory, and verifying its content using grep. ```bash mkdir cfg exec devbox init cfg exists cfg/devbox.json cd cfg exec devbox generate direnv --envrc-dir .. grep 'eval "$(devbox generate direnv --print-envrc --config cfg)"' ../.envrc ``` -------------------------------- ### Test Temporal Workflows Source: https://github.com/jetify-com/devbox/blob/main/examples/cloud_development/temporal/README.md Navigate to your workflow directory within the Devbox shell and run your Python script to start a workflow. This assumes Temporalite is already running. ```bash cd temporal_example/hello python run hello_activity.py ``` -------------------------------- ### Add Packages to Devbox Source: https://github.com/jetify-com/devbox/blob/main/README.md Use `devbox add` to install command-line tools from Nix. Specify the package name and optionally a version. Search for available packages on Nixhub.io. ```bash devbox add python@3.10 ``` -------------------------------- ### Testing the Custom PHP Extension Source: https://github.com/jetify-com/devbox/blob/main/examples/flakes/php-extension/README.md Instructions for testing the custom PHP extension after setting up the development environment. This involves entering the shell, starting PHP interactively, and calling the extension's function. ```bash devbox shell php -a echo skeleton_nop("Hello World"); ``` -------------------------------- ### Build Zig Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/zig/README.md Use this command to build your Zig project. ```bash zig build install ``` -------------------------------- ### Initialize Devbox Source: https://github.com/jetify-com/devbox/blob/main/README.md Run this command in a new directory to create a `devbox.json` file, which tracks your project's dependencies. Commit this file to source control. ```bash devbox init ``` -------------------------------- ### Start Django Development Server Source: https://github.com/jetify-com/devbox/blob/main/examples/stacks/django/README.md Start the Django development server to make your application accessible. The default address is localhost:8000. ```bash python todo_project/manage.py runserver ``` -------------------------------- ### Initialize Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/testscripts/generate/direnv-config.test.txt Initializes a new Devbox project in the specified directory. This command sets up the basic project structure. ```bash mkdir dir exec devbox init dir exists dir/devbox.json ``` -------------------------------- ### Initialize Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/testscripts/generate/direnv-envrcdir-fail-no-config.test.txt Initializes a new devbox project in the './cfg' directory. This command is a prerequisite for subsequent devbox operations. ```bash mkdir cfg exec devbox init cfg exists cfg/devbox.json ``` -------------------------------- ### Devbox Plugin System Usage Source: https://context7.com/jetify-com/devbox/llms.txt Demonstrates adding packages to activate plugins, configuring custom plugins, and viewing plugin contributions. Use `devbox add` to activate plugins and `devbox info` to inspect them. ```bash # Adding postgresql automatically activates the postgresql plugin: devbox add postgresql # The plugin provides: # - PGDATA, PGHOST, PGPORT, PGUSER environment variables # - process-compose service definition for postgresql # - init hook to initialize the data directory if needed # Add a custom plugin from GitHub # In devbox.json: # "include": ["github:my-org/my-devbox-plugin@main"] # Add a custom plugin from a local directory # In devbox.json: # "include": ["path:./my-plugin"] # View what a plugin contributes devbox info postgresql # Complete example: full-stack project with plugin services cat devbox.json ``` -------------------------------- ### Initialize Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/testscripts/generate/direnv-envflag.test.txt Initializes a new Devbox project. This is a prerequisite for generating environment files. ```bash exec devbox init exists devbox.json ``` -------------------------------- ### Add Caddy to Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/examples/servers/caddy/README.md Add Caddy to your project's devbox.json to automatically install it. You can find other installable versions using `devbox search caddy`. ```json { "packages": [ "caddy@latest" ] } ``` -------------------------------- ### Devbox Configuration File Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/add_platforms_flakeref.test.txt A sample devbox.json file showing basic package declarations. ```json { "packages": [ "hello", "cowsay@latest" ] } ``` -------------------------------- ### Ruby Environment Variables for Gem Installation Source: https://github.com/jetify-com/devbox/blob/main/examples/development/ruby/README.md These environment variables are automatically set by Devbox to manage Gem installations locally within your project's virtual environment. ```bash RUBY_CONFDIR={PROJECT_DIR}/.devbox/virtenv/ruby GEMRC={PROJECT_DIR}/.devbox/virtenv/ruby/.gemrc GEM_HOME={PROJECT_DIR}/.devbox/virtenv/ruby PATH={PROJECT_DIR}/.devbox/virtenv/ruby/bin:$PATH ``` -------------------------------- ### Install NumPy with Devbox Source: https://github.com/jetify-com/devbox/blob/main/testscripts/languages/python_patch_missing_so.test.txt Installs the NumPy package using pip within the Devbox environment. The PIP_ONLY_BINARY environment variable is set to 'numpy' to force the download of a binary wheel. ```bash exec devbox install # pip install numpy exec devbox run venv -- pip install numpy==2.1.0 stdout 'Successfully installed numpy' ``` -------------------------------- ### Initialize Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/testscripts/generate/direnv-envrcdir-config-parent.test.txt Initializes a new Devbox project in the current directory. This command creates the necessary devbox.json file. ```bash exec devbox init exists ./devbox.json ``` -------------------------------- ### Install R Packages with Devbox Source: https://github.com/jetify-com/devbox/blob/main/examples/data_science/R/README.md Install R packages from CRAN using Devbox. For packages with dots in their names, replace the dot with an underscore (e.g., `data.table` becomes `rPackages.data_table`). ```json { "packages": [ "R@4.4.1", "rPackages.data_table@latest", "rPackages.ggplot2@latest", "rPackages.tidyverse@latest" ], } ``` -------------------------------- ### Start Devbox Development Shell Source: https://github.com/jetify-com/devbox/blob/main/CONTRIBUTING.md Starts a development shell using the locally built Devbox CLI. VSCode can also be launched from this shell using 'devbox run code'. ```bash dist/devbox shell ``` -------------------------------- ### Install TensorFlow with CUDA Support Source: https://github.com/jetify-com/devbox/blob/main/testscripts/languages/python_patch_cuda.test.txt Installs the nightly build of TensorFlow using pip within a Devbox virtual environment. This command is used to verify that TensorFlow can detect and use CUDA-enabled GPUs. ```bash exec devbox install # pip install tensorflow exec devbox run venv -- pip install tf_nightly==2.18.0.dev20240910 stdout 'Successfully installed.* tf_nightly-2.18.0.dev20240910' ``` -------------------------------- ### Initialize Devbox in Subdirectory Source: https://github.com/jetify-com/devbox/blob/main/testscripts/generate/direnv-envrcdir-config-subdir.test.txt Initializes a new devbox project in a specified subdirectory. This command creates the necessary devbox.json file. ```bash mkdir dir/cfg exec devbox init dir/cfg exists dir/cfg/devbox.json ``` -------------------------------- ### Enable Corepack for Package Manager Management Source: https://github.com/jetify-com/devbox/blob/main/examples/development/nodejs/nodejs-pnpm/README.md Enables Corepack, which is used to install and manage Node Package Managers like pnpm. Corepack binaries are installed in the project's .devbox directory and added to the PATH. ```json { "packages": ["nodejs@18"], "env": { "DEVBOX_COREPACK_ENABLED": "true" } } ``` -------------------------------- ### Source Shell Environment and Test 'hello' Source: https://github.com/jetify-com/devbox/blob/main/testscripts/shell/shellenv.test.txt Source the Devbox shell environment to make packages available in your current shell session, then execute 'hello' and verify its output. ```shell exec devbox shellenv source.path exec hello stdout 'Hello, world!' ``` -------------------------------- ### Run hello package in pure mode Source: https://github.com/jetify-com/devbox/blob/main/testscripts/run/pure.test.txt Executes the 'hello' package in pure mode. This test verifies that packages defined in devbox.json are executable in pure mode and produce their expected output. ```bash exec devbox run --pure hello stdout 'Hello, world!' ``` -------------------------------- ### Manage MySQL Service with DevBox Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/mysql/README.md Commands to start or stop the MySQL service managed by DevBox. ```bash devbox services start mysql ``` ```bash devbox services stop mysql ``` -------------------------------- ### Initialize Devbox Environment Source: https://github.com/jetify-com/devbox/blob/main/testscripts/add/add_insecure.tst.txt Initializes a new devbox environment. This is a prerequisite for adding packages. ```bash exec devbox init ``` -------------------------------- ### Expected Devbox JSON Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/plugin/plugin.test.txt Defines the expected structure of a devbox.json file when only the Python package is installed. ```json { "packages": [ "python@latest" ] } ``` -------------------------------- ### Manage Apache Service Source: https://github.com/jetify-com/devbox/blob/main/examples/servers/apache/README.md Use Devbox services to start and stop the Apache HTTP server in the background. ```bash devbox services start apache ``` ```bash devbox services stop apache ``` -------------------------------- ### Manually Control PostgreSQL Server Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/postgres/README.md Commands to manually start and stop the PostgreSQL server using pg_ctl. ```bash pg_ctl -l .devbox/conf/postgresql/logfile start ``` ```bash pg_ctl stop ``` -------------------------------- ### Environment Variables File Source: https://github.com/jetify-com/devbox/blob/main/testscripts/run/envfrom.test.txt Define environment variables in a plain text file. Lines starting with '#' are comments and are ignored. ```env FOO=BAR FOO2 = BAZ FOO3=ToBeOverwrittenByDevboxJSON # FOO4=comment shouldn't be processed ``` -------------------------------- ### Create Devbox Project from Template (`devbox create`) Source: https://context7.com/jetify-com/devbox/llms.txt Bootstraps a new Devbox project from a template. You can list available templates, create from a named template, or use a remote Git repository. ```bash # List available built-in templates devbox create # Create a project from a named template devbox create my-django-app --template django # Create from a remote Git repository devbox create my-app --repo https://github.com/jetify-com/devbox --subdir examples/stacks/rails/blog # Output: # ✓ Initialized devbox project using template django ``` -------------------------------- ### Start and Stop PHP-FPM Service Source: https://github.com/jetify-com/devbox/blob/main/examples/development/php/latest/README.md Control the PHP-FPM service using Devbox commands. This allows you to run PHP-FPM in the background. ```bash devbox services start|stop php-fpm ``` -------------------------------- ### Devbox Help Command Source: https://github.com/jetify-com/devbox/blob/main/README.md View all available Devbox commands by running the `help` command. ```bash devbox help ``` -------------------------------- ### Run Zig Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/zig/README.md Execute this command to run your Zig project after building. ```bash zig build run ``` -------------------------------- ### Devbox JSON Without Cycle Source: https://github.com/jetify-com/devbox/blob/main/testscripts/plugin/plugin.cycle.test.txt This `devbox.json` configuration demonstrates a valid setup without any circular includes, referencing only `./plugin3`. ```json { "name": "test-without-cycle", "include": ["./plugin3"] } ``` -------------------------------- ### Detect Circular Include Source: https://github.com/jetify-com/devbox/blob/main/testscripts/plugin/plugin.cycle.test.txt Running `devbox install` with a configuration that has a circular include will result in an error message indicating the detected cycle. ```bash ! exec devbox install stderr 'circular or duplicate include detected:' ``` -------------------------------- ### Connect to MySQL Database Source: https://github.com/jetify-com/devbox/blob/main/examples/databases/mysql/README.md Run this command to connect to the MySQL database from the command line. This assumes you have a `connect_db` script configured in your DevBox environment. ```bash devbox run connect_db ``` -------------------------------- ### Add Apache to Devbox Project Source: https://github.com/jetify-com/devbox/blob/main/examples/servers/apache/README.md Install the latest version of Apache using Devbox. You can find other versions by searching or checking Nixhub. ```json { "packages": [ "apache@latest" ] } ``` -------------------------------- ### Add NodeJS to your Shell Source: https://github.com/jetify-com/devbox/blob/main/examples/development/nodejs/nodejs-yarn/README.md Install NodeJS version 18, which includes npm, using the `devbox add` command or by specifying it in your `devbox.json`. ```bash devbox add nodejs ``` ```json { "packages": [ "nodejs@18" ], } ``` -------------------------------- ### Create and Build Haskell Project with Stack Source: https://github.com/jetify-com/devbox/blob/main/examples/development/haskell/my-project/README.md Use these commands to generate a new Haskell project with Stack, navigate into the project directory, build the project, and execute the application. Ensure Devbox shell is activated before running. ```bash stack new my-project cd my-project stack build stack exec my-project-exe ``` -------------------------------- ### Build Rust Project with Cargo Source: https://github.com/jetify-com/devbox/blob/main/examples/development/rust/README.md Use this command to compile your Rust project. Ensure Cargo is installed and configured in your Devbox environment. ```bash cargo build ``` -------------------------------- ### Create New F# Console Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/fsharp/hello-world/README.md Use the `dotnet new` command to create a new F# console application. Specify the language as F# and provide an output directory for the project files. ```bash dotnet new console -lang "F#" -o ``` -------------------------------- ### Build Devbox for Current Platform Source: https://github.com/jetify-com/devbox/blob/main/devbox.md Compiles the Devbox binary for the current operating system and architecture, placing it in the 'dist' directory. ```go go build -o dist/devbox ./cmd/devbox ``` -------------------------------- ### Open VSCode Source: https://github.com/jetify-com/devbox/blob/main/devbox.md Launches Visual Studio Code in the current project directory. ```shell code . ``` -------------------------------- ### Devbox JSON Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/run/script.test.txt Example devbox.json configuration defining packages and shell scripts, including single-line, multi-line, and init hooks. ```json { "packages": [ "hello@latest" ], "shell": { "init_hook": "export HOOK=hook", "scripts": { "single_line": "echo \"single line\"", "multi_line": [ "echo \"first line\"", "echo \"second line\"" ], "hook_runs": "echo $HOOK", "hello_with_script": "hello -g \"with script\"" } } } ``` -------------------------------- ### Build Gradle Project Source: https://github.com/jetify-com/devbox/blob/main/examples/development/java/README.md Compile the Gradle project and create an executable JAR file. This command should be run in the project's root directory. ```bash gradle build ``` -------------------------------- ### Devbox.json configuration for pure mode tests Source: https://github.com/jetify-com/devbox/blob/main/testscripts/run/pure.test.txt Configuration file for devbox, specifying the 'hello' package and an environment variable 'FOO' to be used in pure mode tests. ```json { "packages": ["hello@latest"], "env": { "FOO": "baz" } } ``` -------------------------------- ### Second Expected Devbox JSON Configuration Source: https://github.com/jetify-com/devbox/blob/main/testscripts/plugin/plugin.test.txt Defines the expected structure of a devbox.json file after adding 'hello' and installing Python with its plugin disabled. ```json { "packages": { "hello": "latest", "python": { "version": "latest", "disable_plugin": true } } } ``` -------------------------------- ### Build Devbox for All Platforms Source: https://github.com/jetify-com/devbox/blob/main/devbox.md Runs build commands for multiple target platforms (darwin/amd64, darwin/arm64, linux/amd64, linux/arm64). ```shell devbox run build-darwin-amd64 devbox run build-darwin-arm64 devbox run build-linux-amd64 devbox run build-linux-arm64 ```