bach.toml is the one file that tells Bach how to build your installer. This page explains how it’s laid out, where it goes and what happens when something in it is wrong. It’s worth reading after your first installer.
Where it goes
Putbach.toml in your project folder and keep it in version control with your code. All paths inside it are relative to the folder that holds bach.toml, not to the folder you run the command from.
bach commands from that folder. To use a file somewhere else, pass its path: bach build installer/bach.toml.
Let Bach write the first version
bach.toml with comments that explain the common options. In Rust, Tauri, Electron, .NET, Godot, Unity, Flutter, Wails, PyInstaller and Qt projects it fills in the name, version, program and build folder from your project files. It never overwrites an existing bach.toml.
Sections and settings
The file uses TOML. You only need to know a few things:- A line like
name = "Hello Notes"is a setting. - A line like
[app]starts a section. The settings below it belong to that section. - A line with double brackets, like
[[components]], starts one item of a list. You repeat the whole block for each item. - Text goes in quotes.
true,falseand numbers don’t. - Anything after
#is a comment.
'%APPDATA%\Hello Notes'.
The part every installer needs
bach.toml
bach check tells you which one is missing.
Everything else is optional
Bach has a default for each optional setting, so you only write what you want to change. For example, by default a desktop shortcut is offered and ticked. To not offer one at all:bach.toml
The configuration reference lists every section and setting.
The id: keep it stable
Bach recognizes an installed copy of your app by its id. If you don’t set one, the id is the app’s name. The id also names the install folder and a registry entry. When you release a new version, keep the id the same. If it changes, the new setup file doesn’t see the old installation and installs a second copy next to it. If you ever want to rename your app, set the old name asid first:
bach.toml
Versions
Write versions as numbers with dots, such as1.4.2. A suffix such as 2.0.0-beta.1 is fine. Setup files compare versions to decide whether they’re updating or downgrading. If the version isn’t in this form, Bach warns you, because installed copies can no longer tell which version is newer.
Instead of editing the file for every release, you can pass the version when you build:
v is removed, so a Git tag such as v1.4.2 works directly. bach version can also raise the version in bach.toml and your other project files at once.
Mistakes are caught before building
bach check reads the file, checks every setting, looks at the build folder and lists what would be installed. If something is wrong, it stops with one sentence that names the setting. Unknown settings are errors too, so a typo like excutable is caught instead of silently ignored.
Some things aren’t errors but are probably mistakes, such as debug files in the build folder. Those are printed as warnings. To make a build fail when there are warnings, for example in CI, add --strict.
Editor help
The first linebach init writes points editors at a schema for bach.toml:
bach.toml
The config version
config_version = 1 says which format the file uses. It’s optional today. If a future Bach changes the format, it can tell you instead of building something wrong.