Flox rocks the Nix box by conquering code chaos

FOSS CLI package management framework for repeatable, declarative deployments across multiple platforms

FOSDEM Flox aims to make Nix easier for newcomers, simplifying the job of installing identical development environments across Linux and macOS.

The Reg has looked at the Nix packaging system before, and the distro built with it a year later.

Nix is a radically different way to manage software on Unix-like OSes. It solves a lot of the problems caused by traditional methods, at the price of breaking a lot of assumptions and conventions. So since it was invented 21 years ago, the maintainers of more mainstream distros have invented Snap, Flatpak, AppImage, and others, all in efforts to fix much the same problems.

Tech startup Flox hopes to simplify and demystify Nix, and has just released version 1.0 of its eponymous product, which it calls a virtual environment and package manager all rolled into one.

Alongside the Flox command-line tool, the company offers FloxHub, an online repository for sharing and managing Flox environments. The name is a callback to GitHub, and the commands for dealing with it – uploading Flox environment definitions, managing them and downloading and deploying them – intentionally resemble Git and local package-management commands, which most Linux and Mac developers will already know well.

The Flox platform is based on Nix, and it draws components from the enormous Nixpkgs repository that contains more than 80,000 packages. The plan is to offer a simpler and more familiar interface than Nix itself, which uses its own pure functional language to manage software. The Reg FOSS desk spent some hours talking with Flox CEO Ron Efroni and CTO Michael Brantley at FOSDEM last year.

Pure functional programming has many strengths, such as declarative coding – where you specify what results you want, rather than devising the logic of how to work them out. (Think of SQL: SELECT name FROM students WHERE age >= 12 – you don't need to tell the database how to sort, search, or match; you just tell it what answers you're looking for, and it does the hard part for you.) However, functional programming is such a different way of working from conventional imperative languages that many people find it very hard, to the extent that there are many jokes about it.

Flox wraps up all the complicated Nix stuff so that you just need to list the components you want, and any environment variables to set or commands to run, in a TOML format manifest. You don't need to specify packages or versions or architectures or any of the nitty-gritty – it handles all that for you. Flox then installs or builds whatever is needed to create that exact environment on your target system – whatever that OS happens to be. Flox is currently available in both .deb and .rpm formats, for both x86-64 and ARM64 Linux and ARM64 macOS.

As Flox developer Zach Mitchell puts it in his clear and not-too-technical introduction to Flox 1:

Since all of this is built using Nix, these environments are bulletproof and portable across different operating systems and architectures.

[…]

With Flox you can benefit from Nix without needing to know Nix.

Flox abstracts away and replaces the functionality of any particular distribution's package manager, or add-on ones such as Homebrew on macOS. It also replaces container management systems such as Docker, and for developers, add-on configuration management software such as Red Hat's Ansible.

The company's blog post about the release talks about qualities such as declarative specifications and reproducibility. These are things Flox inherits from its Nix underpinnings. Flox environments are reproducible, meaning you'll get the exact same versions of the same components on each machine, regardless of the OS underneath or what it provides – including if those components have changed since the environment was created.

It's declarative, which means that you just specify the result you want, rather than how to achieve it. You don't need to specify checks for presence of existing components, or repositories or other software sources, or package-handling commands.

It's composable, meaning that environments aren't exclusive like container images. If you want both your front end and your back end environments at once, just activate both and Flox does the rest. The company also claims that its tools are faster than Nix itself, whose slow performance is one of the few complaints we often hear about it.

This vulture has never been a software developer, and so for us, most of this stuff is entirely theoretical. However, we've spoken with quite a few Nix users and their passionate enthusiasm always shines through. They readily concede that it's hard to get to grips with, though, and that it can be slow and very resource-intensive.

Flox seems to confront that problem head on, and impose a simpler and much more familiar model on top of the very alien world of Nix, along with tooling for sharing manifests and environments. For this initial release, Flox is keeping things simple with just a CLI tool and an online repository … but the company has bigger and more ambitious plans for the future.

We will be watching with interest. ®

More about

TIP US OFF

Send us news


Other stories you might like