Configuration Reference¶
When running the zb command-line interface, zb will gather configuration data from files in the local filesystem. Command-line flags or environment variables will override any settings in the configuration files.
Format¶
zb reads its configuration in JSON With Commas and Comments format. This is a strict superset of JSON that permits:
trailing commas in arrays and objects
C++ style
/* block comments */and// line comments
Location¶
Linux and macOS¶
On Linux and macOS systems, zb follows the XDG Base Directory Specification to find its configuration files. The files used are (in decreasing order of precedence):
$XDG_CONFIG_HOME/zb/config.jwcc. If$XDG_CONFIG_HOMEis not set, it defaults to$HOME/.config.$XDG_CONFIG_HOME/zb/config.json. If$XDG_CONFIG_HOMEis not set, it defaults to$HOME/.config.For each directory in
$XDG_CONFIG_DIRSseparated by colons (defaulting to/etc/xdg): a.zb/config.jwccunderneath the directory b.zb/config.jsonunderneath the directory
Windows¶
On Windows systems, zb will find configuration files at (in decreasing order of precedence):
%AppData%\zb\config.jwcc%AppData%\zb\config.json
Properties¶
- debug¶
- Type:
- boolean
- Default:
false
Whether to include logging useful for debugging zb itself. This is generally very verbose and should only be enabled if you are reporting an issue with zb. Equivalent to the
--debugcommand-line flag.
- storeDirectory¶
- Type:
- string
- Default:
/opt/zb/storeon Linux and macOS,C:\zb\storeon Windows
Absolute path to the store directory.
Will be overridden by
ZB_STORE_DIR.
- storeSocket¶
- Type:
- string
- Default:
/opt/zb/var/zb/server.sockon Linux and macOS,C:\zb\var\zb\server.sockon Windows
Absolute path of the store server Unix socket to use or, in the case of
zb serve, to create.Will be overridden by
ZB_STORE_SOCKET.
- cacheDB¶
- Type:
- string
- Default:
$XDG_CACHE_HOME/zb/cache.dbon Linux and macOS. ($XDG_CACHE_HOMEdefaults to$HOME/.cache.)%LocalAppData%\zb\cache.dbon Windows.
Absolute path to a SQLite database that contains cache data for speeding up zb. This database can be deleted at any time: it exists purely to speed up builds.
Equivalent to the
--cachecommand-line flag.
- allowEnvironment¶
- Type:
- boolean or array of string
- Default:
false
The
allowEnvironmentsetting configures the behavior ofos.getenv().If
true, thenos.getenv()can retrieve any environment variable in the zb process’s environment. Equivalent to passing--allow-all-envon the command line.If
false, thenos.getenv()will always returnnil.If the setting is an array, then it is interpreted as a set of environment variable names that
os.getenv()will retrieve from the zb process’s environment.os.getenv()will returnnilfor any environment variable whose name is not in the array. Equivalent to passing--allow-envwith each name on the command line.
allowEnvironmentsettings are not merged: the setting from the file with the highest precedence will be used.
- trustedPublicKeys¶
- Type:
- array of objects
- Default:
[]
The
trustedPublicKeyssetting is an array of public keys that zb will trust for existing build results when building a derivation.trustedPublicKeyssettings are merged across all configuration files. Each public key is a JSON object with the following properties:Name
Type
Description
formatstring
Only
"ed25519"is defined at the momentpublicKeystring
Base64-encoded public key data
For more details on the content of these properties, see realization signature specification.
If the configuration files do not include any trusted public keys, then any previous build result can be reused unless the
--cleancommand-line option is passed.
- server¶
- Type:
- object
- Default:
{}
See Server Configuration.
Store locator¶
A store locator is a JSON object that specifies how to access a store.
The JSON object’s properties are interpreted based on the value of its type property,
which can be one of the following strings:
nullRepresents an empty store. Same as using a JSON
nullinstead of the JSON object. No additional properties.httpA store using the Binary Cache protocol.
httpstore locators have the following properties:Name
Type
Required
Description
urlstring
Yes
URL to the binary cache’s discovery document.
Example:
{ "server": { "download": { "type": "http", "url": "https://www.example.com/zb/cache.json" } } }