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.
Overview
Catalog imports allow your Nix expression builds to depend on packages provided by external sources: FloxHub users and organizations that publish reusable packages, or remote repositories containing Nix expression definitions. Nix expression builds already support vendoring existing packages by copying their expressions into your.flox/pkgs/ directory. Catalog imports extend this model by allowing expression sharing through a central registry at the granularity of catalogs, which correspond to FloxHub user or organization namespaces, or to external repositories. You declare catalogs in a configuration file and access their packages via the catalogs argument in your expressions; this keeps your build inputs explicit, lockable, and reproducible.
Catalog imports are a feature of Nix expression builds specifically; they do not apply to manifest-based builds. You should be familiar with defining packages in .flox/pkgs/ before using catalog imports.
Configuring catalogs
Catalog imports use two files:.flox/nix-builds.toml, the user-authored configuration file where you declare which catalogs to use..flox/nix-builds.lock, a generated lockfile that pins each catalog to a specific revision for reproducibility.
git added) and should be committed to version control. The TOML file is authored by hand; the lockfile is generated and updated by the flox build update-catalogs command.
Catalog types
FloxHub catalogs
A FloxHub catalog references packages published to FloxHub viaflox publish. The catalog name corresponds to the FloxHub user or organization that published them.
.flox/nix-builds.toml
.flox/nix-builds.toml
flox auth login. Organization catalogs are accessible to all members of the organization. Cross-user catalog sharing is not yet available on public FloxHub; for now, catalog imports between users require Flox on-prem.
Nix source-ref catalogs
A source-ref catalog points at any Nix source reference: a Git repository, tarball, or other supported source type. The most common case is a Git repository that contains Flox package definitions (a.flox/pkgs/ directory).
You can declare a source-ref catalog in structured form, specifying the type and additional fields:
.flox/nix-builds.toml
url field using Nix source reference syntax (the git+ prefix encodes the type):
.flox/nix-builds.toml
[catalogs] header for simple cases:
.flox/nix-builds.toml
Common fields for git sources
| Field | Description |
|---|---|
ref | Git ref to track (branch, tag). Defaults to the repository’s default branch. |
dir | Subdirectory containing the .flox/pkgs/ tree. Useful for monorepos. |
shallow | If true, perform a shallow clone. Defaults to false. |
github, gitlab, tarball, etc.) accept their own fields; for example, github and gitlab support a host field for self-hosted instances. See the Nix source types reference for the full list.
These fields are written as separate TOML keys when using the structured form (type + url). When using the URL shorthand, encode them as query parameters instead:
.flox/nix-builds.toml
.flox/nix-builds.toml
Using catalogs in expressions
Once catalogs are declared in.flox/nix-builds.toml and the lockfile is generated, you access imported packages through the catalogs argument in your Nix expressions.
Access packages by catalog name and package name:
.flox/pkgs/demo.nix
catalogs argument can be combined with other arguments from nixpkgs:
.flox/pkgs/my-app.nix
Updating catalog locks
Before you can build with catalog imports, you must generate the lockfile. Run:.flox/nix-builds.toml and writes the pinned revisions to .flox/nix-builds.lock.
Re-run this command whenever you:
- Add or change a catalog entry in
.flox/nix-builds.toml - Want to pick up newer versions of packages from a catalog
git add and commit both .flox/nix-builds.toml and .flox/nix-builds.lock.
If you run If the lockfile exists but is stale (you added or changed a catalog in In either case, run
flox build without a lockfile, you will see:.flox/nix-builds.toml without re-running flox build update-catalogs), the error will be:flox build update-catalogs to resolve catalog entries and regenerate the lockfile.Examples
Example: FloxHub catalog
This example uses a package published to FloxHub by the organizationmy-org.
1. Declare the catalog:
.flox/nix-builds.toml
.flox/pkgs/demo.nix
Example: Git catalog
This example imports a Rust application from the flox-build-examples repository. 1. Declare the catalog:.flox/nix-builds.toml
.flox/pkgs/demo.nix
Example: Combining catalogs with nixpkgs
A realistic expression might use both catalog imports and standard nixpkgs helpers:.flox/pkgs/my-tool.nix
rustPlatform and lib come from nixpkgs, as with any standard Nix expression build. The catalogs.shared-libs.crypto-utils dependency is resolved from the declared catalog.