Flake-Parts Module
Located at nix/flake-parts/turnkey/default.nix.
Purpose
Provides the user-facing API for Turnkey configuration in flakes.
Options Reference
turnkey.toolchains.enable
type = types.bool;
default = true;
Enable/disable Turnkey toolchain management.
turnkey.toolchains.declarationFiles
type = types.attrsOf types.path;
default = {};
Map shell names to toolchain.toml files:
declarationFiles = {
default = ./toolchain.toml;
ci = ./toolchain.ci.toml;
};
turnkey.toolchains.registry
type = types.lazyAttrsOf types.package;
default = {};
Custom toolchain registry. If empty, uses default registry.
turnkey.toolchains.wrapNativeTools
type = types.bool;
default = true;
Wrap go, cargo, uv with auto-sync behavior. Every version of the
registry's entry is wrapped, so the wrapper runs the tool toolchain.toml
resolves.
turnkey.toolchains.buck2
Nested options for Buck2 integration. They are declared once, in
nix/buck2/options.nix, which the devenv module uses as well; this module
adds only buck2.shells, builds the dependency cells, and hands the whole
value to each shell's devenv module. The main ones:
enable- Enable Buck2 cell generationprelude.path- A prelude to use instead of turnkey's (off the supported path; turns test result caching off)go.enable,go.depsFile- Go dependency configurationrust.enable,rust.depsFile- Rust dependency configurationpython.enable,python.depsFile- Python dependency configuration
Implementation
The module:
- Imports default registry
- Builds tw wrappers for native tools
- Creates shell configurations for each declaration file
- Passes configuration to devenv module
Extending
Add new options in the options.perSystem block and implement in config.perSystem.