Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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 generation
  • prelude.path - A prelude to use instead of turnkey's (off the supported path; turns test result caching off)
  • go.enable, go.depsFile - Go dependency configuration
  • rust.enable, rust.depsFile - Rust dependency configuration
  • python.enable, python.depsFile - Python dependency configuration

Implementation

The module:

  1. Imports default registry
  2. Builds tw wrappers for native tools
  3. Creates shell configurations for each declaration file
  4. Passes configuration to devenv module

Extending

Add new options in the options.perSystem block and implement in config.perSystem.