mix_workspace

Native Mix project seed.

Description#

mix_workspace evaluates mix.exs for development, test, and production, then emits ordinary mix_dependencies, mix_project, elixir_test, and mix_release targets. The native manifest and lockfile stay authoritative.

For a leaf project, the seed's build capability follows mix_env, then MIX_ENV, defaulting to the development application. For an umbrella root, it selects the detected child mix_workspace seeds. Nested projects and path dependencies preserve their workspace-relative layout. From an unconfigured project directory, once build and once test automatically select the current Mix project. The nearest Git repository root contains sibling path dependencies without requiring an extra manifest. Unrelated native integrations are not resolved by default. The same boundary and family scope apply to run, lint, and --all; an explicitly selected native seed in the selected package can choose another family. Repository-root commands without an explicit native target keep ordinary discovery, and containing explicit manifests take priority.

Native compilation includes non-hidden project files outside generated build and dependency directories as conservative data inputs. Compile-time resources and custom compiler sources therefore invalidate cached application output. Compilation identities also include the source location, so bytecode containing directory-sensitive resources is not reused across different checkout paths.

Native test targets use Mix's configured test paths and aliases. They run on every invocation and inherit the host runtime environment so database setup and host tools behave like an ordinary mix test. Application and dependency compilers run through Once's build actions, not again inside the test alias.

Projects with external dependencies must already have a current mix.lock and materialized dependency sources. A project with only local path dependencies can omit its lockfile. Resolution runs with isolated Mix and Hex homes and Hex offline mode.

Materialize the exact locked sources before previewing or loading the graph:

bash
mix deps.get --check-locked

Use mix deps.get without --check-locked only when intentionally creating or updating the lockfile.

Attributes#

AttributeTypeRequiredDefaultDescription
mix_envstringnoemptyDefault build environment; otherwise follows MIX_ENV, then dev
manifeststringnomix.exsPackage-relative Mix project manifest
lockfilestringnomix.lockPackage-relative authoritative lockfile
resolver_inputslist<string>nosrcsText inputs available while deriving the graph

Dependency Edges#

EdgeAcceptsDescription
depsmix_project, mix_workspaceDefault development application or nested workspace selected by the resolver

Providers#

The target emits mix_workspace.

Capabilities#

CapabilityOutput groups
buildnone

Direct Use#

Inspect the automatically derived graph:

bash
once query workspace once query targets

No once.toml is required. To configure the resolver explicitly, author a target equivalent to:

toml
[[target]] name = "mix" kind = "mix_workspace" srcs = ["mix.exs"] [target.attrs] resolver_inputs = ["mix.exs", "mix.lock", ".formatter.exs", "config/**/*.exs"]

Sources#