Now lets flox installtools that will be useful on any
system regardless of the project.
Here we are installing curl, gitFull, gnupg, inetutils, tree, and
vim.
$ floxinstallcurlgitFullgnupginetutilstreevim
✅ 'curl' installed to environment default at /Users/youruser✅ 'gitFull' installed to environment default at /Users/youruser✅ 'gnupg' installed to environment default at /Users/youruser✅ 'inetutils' installed to environment default at /Users/youruser✅ 'tree' installed to environment default at /Users/youruser✅ 'vim' installed to environment default at /Users/youruser
Let's inspect the contents of the environment with flox list:
$ floxlist
curl: curl (8.4.0)gitFull: gitFull (2.42.0)gnupg: gnupg (2.4.1)inetutils: inetutils (2.5)tree: tree (2.1.1)vim: vim (9.0.2116)
We can test the environment is working properly with
flox activate.
$ floxactivate
flox [default] $ which git/Users/youruser/.flox/run/aarch64-darwin.default/bin/gitflox [default] $ git --versiongit version 2.42.0
Everything is working!
Layering a project environment
Now that we have our tools in the default environment we can layer on a new
environment that brings in project-specific dependencies.
For this example we will use a publicly accessible Node project called
material-ui.
Let's clone the example project to our home directory and enter the project's
directory:
flox [default] $ git clone https://github.com/mui/material-ui.gitCloning into ...flox [default] $ cd material-ui
Use flox init from the material-ui directory that we are in.
We now have access to both the dependency this project needs (yarn) and the
tools we need to do development on any project (vim, git, etc)!
You can layer as many environments as you want.
If two environments contain the same package,
Flox will use the package from the last environment activated.
You can use flox envs to see the environments you have activated.
$ floxenvs
✨ Active environments: material-ui /home/youruser/material-ui default /home/youruserInactive environments: