Expand description
CABIN_* environment variable name constants and the typed
builder for the cabin run / cabin test package-execution
overlay.
Cabin is Cargo-inspired (not Cargo-compatible): the env vars
it reads on the input side and the env vars it sets on the
output side both follow Cargo’s naming conventions where
the semantics line up, and diverge with CABIN_* names where
Cabin’s C/C++ semantics differ. This crate is the single
source of truth for both halves so the rest of the codebase
agrees on names.
Crate boundaries:
- this crate must not run processes, read configuration files, or touch the filesystem;
- it must not depend on
cabin,cabin-build, or other higher-level crates that would create cyclic dependencies; - it consumes typed inputs and produces typed outputs (the
orchestration layer is responsible for mapping resolved
values into
PackageEnvInputs).
§Read-side env vars
Constants for every CABIN_* variable Cabin’s CLI reads
live as pub const ... : &str = "..." in this crate. The
orchestration layer reads each one through std::env::var
(or an injected env_fn for tests) and threads the value
through to the right resolver.
§Run / test overlay
cabin run and cabin test inject exactly the same small,
stable set of package-execution variables built by
package_env. The overlay is layered on top of the
inherited environment; it never clears the user’s PATH,
LANG, etc.
Re-exports§
pub use build_flags::CFLAGS;pub use build_flags::CPPFLAGS;pub use build_flags::CXXFLAGS;pub use build_flags::EnvBuildFlags;pub use build_flags::EnvBuildFlagsError;pub use build_flags::LDFLAGS;pub use build_flags::parse_env_build_flags;
Modules§
- build_
flags - Read-side ingestion of the conventional C/C++ build-flag
environment variables:
CPPFLAGS,CFLAGS,CXXFLAGS, andLDFLAGS.
Structs§
- Package
EnvInputs - Inputs for
package_env. The orchestration layer fills this in from already-resolved typed values.cabin runandcabin testuse the same shape — the injected overlay does not depend on whether the target is a binary or a test.
Enums§
- Bool
Error - Errors produced by
parse_bool.
Constants§
- CABIN_
BUILD_ DIR - Build output directory. Honored by commands that write to,
read from, or deliberately exclude the build directory:
cabin build,cabin clean,cabin run,cabin test,cabin fmt, andcabin tidy. - CABIN_
BUILD_ JOBS - Number of parallel jobs the build backend should use.
Cargo-style: positive integer,
0is rejected. Cabin reads this env var when--jobsis not on the command line. - CABIN_
CACHE_ DIR - Override for the artifact cache directory for a single
invocation. Honored by every command that resolves an
artifact cache. Wins over
CABIN_CACHE_HOMEand the XDG fallbacks below it. - CABIN_
CACHE_ HOME - Override for the per-user cache home — the directory cabin’s
global cache lives under. Defaults to
$XDG_CACHE_HOME/cabin, falling back to$HOME/.cache/cabin, per XDG Base Directory conventions. Mirrors the precedence shapeCABIN_CONFIG_HOMEuses for the per-user config home. - CABIN_
COMPILER_ WRAPPER - Compiler-cache wrapper selector (
ccache,sccache,none). Honored bycabin-toolchain’s wrapper resolver. - CABIN_
CONFIG - Path to a single explicit Cabin config file. When set, no other config files are loaded.
- CABIN_
CONFIG_ HOME - Override for the per-user config home (the directory under
which Cabin looks for
config.toml). Honored by thecabin-configcrate’s discovery layer. - CABIN_
FMT - Override for the
clang-formatexecutable Cabin spawns fromcabin fmt. When set and non-empty, the value is used verbatim (typically an absolute path) and thePATHlookup is skipped. When unset, Cabin spawnsclang-formatfromPATH. - CABIN_
MANIFEST_ DIR - Absolute path to the package’s manifest directory.
- CABIN_
MANIFEST_ PATH - Absolute path to the package’s
cabin.tomlmanifest. - CABIN_
NET_ OFFLINE - Forbid network access for this invocation. Equivalent to
passing
--offlineon the CLI. The CLI flag still takes precedence; the env var only sets the default. - CABIN_
NO_ CONFIG - When truthy, Cabin loads no config files at all. Used by the
integration test harness so a developer’s
~/.config/cabin/config.tomlcannot leak into tests. - CABIN_
PACKAGE_ NAME - Package name in the form the manifest declares.
- CABIN_
PACKAGE_ VERSION - Resolved package version (
<major>.<minor>.<patch>plus any pre-release / build suffix exactly as the manifest declares). - CABIN_
PKG_ CONFIG - Override for the
pkg-configexecutable Cabin spawns when probingsystem = truedependencies. Same shape asCABIN_FMTand the other Cabin tool overrides: when set and non-empty the value is used verbatim (typically an absolute path) and thePATHlookup is skipped; when unset, Cabin spawnspkg-configfromPATH. Cabin only invokespkg-configwhen the workspace declares at least onesystem = trueentry. - CABIN_
PROFILE - Active profile name (
dev,release, or any custom profile). - CABIN_
TERM_ COLOR - Terminal-color selector (
auto,always, ornever). Honored by the CLI when--coloris not present. - CABIN_
TERM_ QUIET - Suppress Cabin-owned status output when no
-q/--quietCLI flag is present. - CABIN_
TERM_ VERBOSE - Enable verbose Cabin-owned status output when no
-v/--verboseCLI flag is present. - CABIN_
TIDY - Override for the
run-clang-tidyexecutable Cabin spawns fromcabin tidy. Same shape asCABIN_FMT: when set and non-empty the value is used verbatim and thePATHlookup is skipped, otherwise Cabin resolvesrun-clang-tidyagainstPATH.
Functions§
- package_
env - Build the
CABIN_*overlay surfaced to acabin run/cabin testchild process. Returns a deterministicBTreeMapso two calls with the same inputs are byte-equal. Infallible: every value is copied straight from the typed inputs. - parse_
bool - Whether a raw env-var value should be treated as truthy.
Mirrors Cargo: any of
1,true,yes,on(case- insensitive) is truthy; an empty string is falsy; anything else is rejected viaBoolError::Invalid.