GitHub Actions is the continuous integration (CI) platform built into GitHub. devenv lets you reuse your existing development environment in GitHub Actions workflows to run checks, builds, tests, and more — giving you the same reproducible environment in CI that you have locally. This guide walks through the steps to set up devenv in a GitHub Actions workflow and shows how to run commands in the devenv shell. The following sampleDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/cachix/devenv/llms.txt
Use this file to discover all available pages before exploring further.
devenv.nix is used throughout the examples:
hello package prints “Hello, world!” and the custom say-bye script prints “bye”.
Prerequisites
Before running devenv commands, prepare the job environment with the following steps:- Checks out the repository.
- Installs and sets up Nix.
- Configures Nix to use the devenv Cachix binary cache to speed up installation.
- Installs devenv.
If you’re using a self-hosted runner, you can pre-install both Nix and devenv and skip the associated setup steps.
Running devenv in CI
devenv test
devenv provides a convenient built-in devenv test command. It builds the shell and runs any defined git hooks against your repository — a quick way to verify your development environment works and lint your code at the same time.
Run a single command
Single commands can be passed directly todevenv shell:
Run multiple commands
Eachrun step in a job launches a separate shell, so you can’t run devenv shell in one step and have subsequent steps inherit that environment. Instead, use the shell option to replace the default shell for a step with the devenv shell:
run steps, set devenv as the default shell for the entire job using defaults.run:
Complete example
The full workflow combining all of the above:Using with Nix Flakes
If you’re using devenv with Nix Flakes andnix develop to set the shell for a step, wrap the command in bash to set the necessary environment variables for devenv to work inside the restrictive flake shell:
