Devenv Module
Located at nix/devenv/turnkey/default.nix.
Purpose
Configures individual devenv shells with toolchains and Buck2 integration.
Options
turnkey.enable
Enable Turnkey for this shell.
turnkey.declarationFile
Path to toolchain.toml file.
turnkey.registry
Package registry (usually inherited from flake-parts).
How It Works
- Parse TOML: Reads toolchain.toml
toolchainDeclaration = builtins.fromTOML (builtins.readFile cfg.declarationFile);
toolchainNames = builtins.attrNames toolchainDeclaration.toolchains;
- Resolve packages: Maps names to packages
resolvedPackages = map (name: cfg.registry.${name}) toolchainNames;
- Add to shell: Packages added to devenv
config.packages = resolvedPackages;
Sub-Module: buck2.nix
The buck2.nix sub-module (nix/devenv/turnkey/buck2.nix) handles:
- Toolchains cell generation
- Prelude cell symlink
- Dependency cell symlinks
- Shell entry hooks
Shell Entry Hooks
Devenv's enterShell hook:
- Symlinks
.turnkey/prelude→ Nix store - Symlinks
.turnkey/toolchains→ Nix store - Symlinks dependency cells if configured
- Displays welcome message
Debugging
Enable verbose output:
TURNKEY_VERBOSE=1 nix develop