Introduction

environments is a framework for adding development environments—including programming language interpreters and compilers, linters, formatters, etc.—to code repositories. It provides defaults for generic projects, as well as for specific languages and frameworks, and allows for these environments to be activated and deactivated independently of one another. It also allows local, project-specific environments to be created alongside the officially provided ones.

Available environments:

  • c
  • default
  • documentation
  • git
  • haskell
  • java
  • javascript
  • just
  • lilypond
  • markdown
  • nix
  • python
  • ruby
  • rust
  • toml
  • tree-sitter
  • typescript
  • typst
  • yaml
  • zola
  • environments

Installation

To get started, make sure you have Nix installed, for example, using the Determinate Systems Nix installer:

curl -fsSL https://install.determinate.systems/nix | sh -s -- install

Optionally, install direnv, which will allow the development environment(s) to activate automatically when cd-ing into the project directory.

Once installed, you can initialize and activate a repository by cd-ing into it and running the following, specifying the name(s) of any environments you want to activate, or leaving them blank to activate the default environment only:

nix run \
  github.com:tymbalodeon/environments?dir=init# [ENVIRONMENT]...

Once activated, environments can be managed via just and the included nushell scripts. Run just environment (or the alias just env) to see all available commands.

Configuration

Some environments include configuration options that can be set in the .environments/environments.toml file. These options are documented below, with the default values shown.

just output

Running just will display a list of available commands. Commands can be hidden (but will still be callable) by adding the setting hide = true to an environment configuration. Commands for the default environments can be hidden by adding the global setting hide_default = true.

Every environment comes with its own help recipe. These can all be hidden from the output of just by adding the global setting hide_help = true.

To view hidden help text without updating the .environments/environments.toml file, run just help --all.

global

hide_default = true # Hide commands for default environments in `just` output
hide_help = true # Hide help recipes in `just`output

default

[[environments]]
name = "default"
hide = true # Hide commands for environment in `just` output
todo.exclude_paths = [] # Paths or globs to ignore in `just todo`

python

[[environments]]
name = "python"
hide = true # Hide commands for environment in `just` output
root = "" # The directory containing `pyproject.toml`

ruby

[[environments]]
name = "ruby"
hide = true # Hide commands for environment in `just` output
root = "" # The directory containing `Gemfile`