> ## Documentation Index
> Fetch the complete documentation index at: https://flox.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Builds

> Understanding how to build packages with Flox

The typical development lifecycle involves a step where your source code and potentially some other assets are bundled together into a package.
That package could be a compiled executable, an archive containing source files, or something else entirely.

A Flox environment ensures that the same set of tools, dependencies, and environment variables are available where the environment is activated, whether that's during development, running in CI, or *when building packages*.
Flox environments have native support for defining builds that should be performed in the context of the environment, making it quick and easy to transition from *developing* your software in a reliable and reproducible way, to *building* your software in a reliable and reproducible way.

## Defining builds

There are two ways to define builds, depending on your needs:

* [Manifest builds](/concepts/manifest-builds) allow you to use the tools and commands you're already familiar with to easily build packages with a reasonable amount of reproducibility
* [Nix expression builds](/concepts/nix-expression-builds) are for truly reproducible builds and modify existing packages, if you're already familiar with or willing to learn some of the Nix language

## Performing builds

Builds are performed with the [`flox build`](/man/flox-build) command.
When invoked with no other arguments, `flox build` will execute each build defined in the environment.
You can optionally specify which builds to perform:

```bash theme={null}
flox build myproject
```

For each build that `flox` successfully executes, a symlink named `result-<name>` will be placed in the root directory of the project.
These symlinks link to the read-only locations where the contents of each package are stored.
Continuing with the `myproject` example, after the build you could run the compiled binary via

```bash theme={null}
./result-myproject/bin/myproject
```

## Cross-platform builds

When you build a package, it is built on your host machine, and therefore only built for the system (`aarch64-darwin`, `x86_64-linux`, etc) of your host machine.
This means that if you want packages built for multiple platforms, you need to run the build on multiple platforms.
One way to accomplish this is to run your builds in [CI](/tutorials/ci-cd).
