Contributing
Join our community on Discord to discuss the development of devenv.
When contributing, please note that smaller pull requests have a higher chance of being accepted, and pull requests with tests will be prioritized.
We have a rule that new features need to come with documentation and tests (devenv-run-tests) to ensure the project stays healthy.
Preparing the devenv development environment
-
Follow the installation instructions for Nix and Cachix and install direnv.
-
git clone https://github.com/cachix/devenv.git -
cd devenv -
To build the project, run
direnv allow .or build devenv manually usingnix build .#devenvwhich allows to run development version of devenv outside of source code directory by calling<PATH-TO-DEVENV-SOURCE-CODE>/result/bin/devenv.
Creating development project
-
mkdir devenv-project && cd devenv-project -
<PATH-TO-DEVENV-SOURCE-CODE>/result/bin/devenv init -
Add devenv input pointing to local source directory to
devenv.yaml
<PATH-TO-DEVENV-SOURCE-CODE>/result/bin/devenv update
Repository structure
- The
devenvCLI is indevenv/src/main.rs. - The
flake.nixauto-generation logic lies indevenv/src/flake.tmpl.nix. - All modules related to
devenv.nixare insrc/modules/. - Examples are automatically tested on CI and are the best way to work on developing new modules, see
examples/andtests/ - Documentation is in
docs/. - To run a development server, run
devenv up. - To run a test from
examples/ortests/, run<PATH-TO-DEVENV-SOURCE-CODE>/result/bin/devenv-run-tests --only <name>.
Contributing language improvements
Language integration happens in stages. We welcome even the most basic support for getting started.
For detailed information about the language module structure, development tools pattern, and guidelines for adding new languages, see src/modules/languages/README.md.
The most basic language support starts with the languages.*.enable flag, which turns on basic tooling.
For an example, see src/modules/languages/elm.nix.
The next step is to make the tooling customizable, so the versions can be overridden.
Most languages will come with either a languages.*.package or languages.*.packages option that allows the user to customize what version or package of the language they want to pick.
A further step is to provide languages.*.version option, which allows the user to specify the exact version of the language.
For an example, see src/modules/languages/rust.nix.