Skip to main content
The Flox Catalog tracks nixpkgs, which means there can be a short delay between an upstream release and its availability in the catalog. See What is the Base Catalog? for details on how the catalog tracks nixpkgs and how often it updates. If you need a newer version right away, you can override the existing build recipe to point at the new release, then build and publish it so the updated version is available everywhere. This tutorial walks through the full workflow using Nix expression builds.

Scenario

Imagine the Flox Catalog currently provides hello version 2.12.1, but you need version 2.12.2. Rather than waiting for the catalog to catch up, you’ll override the build recipe to use the newer release.

Create an environment

Let’s start by creating a fresh environment for our override:

Write the override

Create a Nix expression that takes the existing hello build recipe and overrides its version and src attributes:
The attributes you need to override depend on how the package is defined in nixpkgs. Different packages may use different attribute names or build patterns. Check the nixpkgs source for the package you’re modifying.
.flox/pkgs/hello/default.nix
The hash is set to an empty string because we don’t know the correct value yet. We’ll let the build tell us in the next step.

Set up Git

Nix expression builds require that all files in .flox/pkgs/ are tracked by Git. Let’s initialize a repository and add our files:

Get the correct hash

Run flox build and it will fail with the expected hash:
Copy the hash from the got: line and paste it into your expression:
.flox/pkgs/hello/default.nix

Build the package

Now run flox build again:
Verify it works:

Publish the package

The flox publish command requires a remote and all tracked files committed and pushed. Let’s set that up and publish:
The following example uses $PWD as the Git remote for simplicity. In practice, you should use a proper remote repository (for example on GitHub) so that others can reproduce your build.
The flox publish command performs a clean build from a temporary checkout to ensure the package is fully reproducible. See the publishing concept page for more details.

Install from another environment

Once published, the overridden package is available in any Flox environment. Let’s create a new environment and install it there:
Verify you have the overridden version:

Next steps

This tutorial covered the simplest override — bumping a version number. The Nix expression builds concept page covers additional patterns: For a full walkthrough of the build and publish workflow, including manifest builds, see the Building and publishing packages tutorial.