Flox makes it simple to have the same environment on
multiple systems and CPU architectures.
This guide walks through an example between two coworkers who have different
system types,
and shows how to customize your environment with system-specific dependencies.
Creating an environment
To get started,
let's create an environment from a Linux laptop.
This laptop is using an ARM CPU (aarch64) which makes its full system
type aarch64-linux.
When using flox search you may see packages that won't immediately work with your manifest, but finding and allowing system specific packages is very easy.
Flox shows software from the following systems: aarch64-darwin, x86_64-darwin, aarch64-linux, and x86_64-linux.
Some packages may support only a subset of system types. You can inspect a
package with flox show to see what system types are supported:
First let's install some packages to our environment running on Linux:
$ floxinit--nameeng-team-tools
✨ Created environment eng-team-tools (aarch64-linux)...$ floxinstallgnupgvim
✅ 'gnupg' installed to environment eng-team-tools at /home/youruser✅ 'vim' installed to environment eng-team-tools at /home/youruser
To make it easy to share this system across platforms we are going to share it
on FloxHub with flox push.
$ floxpush
✅ eng-team-tools successfully pushed to FloxHub Use 'flox pull youruser/eng-team-tools' to get this environment in any other location.
Using the environment from a different system type
Many packages in Flox will work without any issue across system types.
To test this out, run flox pull from another system such as an
Apple machine with an M-series processor.
This system type is aarch64-darwin.
Then lets run the a simple gpg --version command to test everything is working.
$ floxpullyouruser/eng-team-tools
✨ Pulled youruser/eng-team-tools from https://hub.flox.dev You can activate this environment with 'flox activate'$ floxactivate--gpg--version
gpg (GnuPG) 2.4.5libgcrypt 1.10.3Copyright (C) 2024 g10 Code GmbH...
Looks like the environment works cross-platform, nice!
Handling unsupported packages
However, some packages only work with a subset of systems.
To demonstrate this let's install a package that isn't compatible with an Apple machine.
From the Linux machine...
$ floxinstallsystemd
⚠️ 'systemd' installed only for the following systems: aarch64-linux, x86_64-linux
Flox installs the package for all systems that it's compatible with,
but it skips Apple systems since they don't support the package.
We can push this update so we can list packages from the Apple machine to verify
everything works.
$ floxpush
✅ Updates to eng-team-tools successfully pushed to FloxHub Use 'flox pull youruser/eng-team-tools' to get this environment in any other location.
Then, from the Apple machine, let's pull the latest and inspect the manifest.
$ floxpull
✅ Pulled youruser/eng-team-tools from https://hub.flox.dev/You can activate this environment with 'flox activate'$ floxlist
gnupg: gnupg (2.4.5)vim: vim (9.1.0377)$ floxlist-c
...[install]gnupg.pkg-path = "gnupg"vim.pkg-path = "vim"systemd.pkg-path = "systemd"systemd.systems = ["aarch64-linux", "x86_64-linux"]...
The Apple machine does not have systemd, because the systemd.systems list
specifies that systemd should only be installed on Linux.
This environment will activate on both machines and the Apple machine won't
get the systemd package.