LinuxCommandLibrary

flox

Create reproducible development environments

TLDR

Create a new environment in the current directory

$ flox init
copy

Enter an environment, or create one if it doesn't exist
$ flox activate
copy

Search for packages in the FloxHub catalog
$ flox search [package]
copy

Install a package into the current environment
$ flox [[i|install]] [package]
copy

Uninstall a package from the current environment
$ flox uninstall [package]
copy

View a list of all packages installed in the current environment
$ flox [[l|list]]
copy

Push a local environment to FloxHub to share with others
$ flox push
copy

Pull a shared environment from FloxHub
$ flox pull [environment_name]
copy

SYNOPSIS

flox [GLOBAL_OPTIONS] COMMAND [COMMAND_OPTIONS] [ARGUMENTS...]
flox COMMAND --help

Common commands:
flox init [PROJECT_NAME]
flox install [PACKAGES...]
flox run PROGRAM [ARGS...]
flox shell

PARAMETERS

--config
    Path to the flox configuration file.

-h, --help
    Displays help information for the command or subcommand.

--log-format
    Specifies the format for log output (e.g., json, text).

--profile
    Selects a specific profile for the operation (e.g., user, system).

-v, --verbose
    Increases logging verbosity, showing more detailed output.

-V, --version
    Prints the flox version information.

DESCRIPTION

flox is a powerful command-line tool designed to create and manage
declarative development environments. It allows developers to specify
all the dependencies, tools, and configurations for a project in a
version-controlled definition, often leveraging the underlying power of
Nix. This approach ensures that every developer working on a project,
regardless of their local machine setup, has an identical and
reproducible development environment.

Key benefits include streamlined developer onboarding, consistent
builds across different machines, and the elimination of "it works on my
machine" issues. flox achieves this by creating isolated environments
where tools and libraries are managed precisely, preventing conflicts
with system-wide installations. It offers commands to initialize new
environments, install packages, run commands within an environment,
and switch into a fully configured shell. By making environments
declarative and shareable, flox significantly simplifies complex
dependency management and enhances team collaboration.

CAVEATS

flox relies heavily on the Nix package manager, which introduces a
learning curve for users unfamiliar with Nix concepts and its
functional approach to package management. While it aims to simplify
Nix usage, a basic understanding can be beneficial for advanced
configurations and debugging. Environments created by flox can
sometimes consume significant disk space due to Nix's immutable
store. It's also a relatively newer tool compared to established
alternatives, meaning its ecosystem and community support are still
growing.

<I>DECLARATIVE CONFIGURATION</I>

At its core, flox promotes a declarative approach to
environment management. Instead of imperative scripts that describe
how to set up an environment, flox configurations describe
what the environment should look like. This allows for
version-controlled environment definitions that are easily shared,
audited, and rolled back.

<I>ENVIRONMENT SHARING AND COLLABORATION</I>

One of flox's key strengths is facilitating seamless
environment sharing among team members. By committing the
environment definition to source control, new team members can
onboard rapidly by simply running a flox command, guaranteeing
they have the exact same toolchain and dependencies as the rest
of the team. This significantly improves consistency and reduces
setup-related issues.

HISTORY

flox was developed by Flox, Inc. (later rebranded as Jetpack.io),
founded in 2021. It emerged from the growing need for more reliable
and reproducible development environments, addressing challenges
often faced with traditional package managers and ad-hoc setup
scripts. The project aimed to abstract away the complexities of Nix
while leveraging its strengths, making declarative environments more
accessible to a broader developer audience. Its development focuses
on providing a user-friendly interface for defining, sharing, and
managing environments across diverse operating systems and teams.

SEE ALSO

nix(1): The underlying package manager that flox often utilizes for environment construction., devbox(1): Another tool that provides declarative developer environments, often compared to flox., docker(1): Containerization platform used for isolating applications and their dependencies, a different approach to environment reproducibility., podman(1): A daemonless container engine, an alternative to Docker for creating isolated environments., direnv(1): Manages environment variables based on the current directory, often used in conjunction with other environment tools.

Copied to clipboard