Composing Using Imports
You can compose environments either locally or by referencing inputs.
Imagine you're building a typical web application with separate frontend and backend components
that live in separate folders.
You've also written a custom Redis integration in devenv/devenv.nix,
stored in a remote https://github.com/mycompany/redis.devenv repository.
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
redis:
url: github:mycompany/redis.devenv
imports:
- ./frontend
- ./backend
- redis/devenv
If you enter the frontend directory, the environment will activate based on what's in the frontend/devenv.nix file.
If you enter the top-level project, the environment is combined with what's defined in backend/devenv.nix and frontend/devenv.nix.
For example, devenv up will start both the frontend and backend processes.
Note
While composing devenv.nix is a key feature,
composing devenv.yaml hasn't been implemented yet.
See devenv.yaml reference for all supported imports.