nixfredFLOXFIELD GUIDE · BY NIX UNOFFICIAL
REFERENCE / CLI CHEAT SHEET

CLI cheat sheet

The Flox commands a customer actually types, grouped the way flox --help groups them: manage, use, discover, modify, share, administer. Each row gives what the command does, the flags worth knowing, one example and the man page it came from. The last sections list the documented environment variables and config keys, and the exact non-interactive forms that are safe in scripts and AI agents.

This page is drawn from https://flox.dev/docs/man/flox, https://flox.dev/docs/man/flox-init, https://flox.dev/docs/man/flox-activate, https://flox.dev/docs/man/flox-install, https://flox.dev/docs/man/flox-search, https://flox.dev/docs/man/flox-push, https://flox.dev/docs/man/flox-config, https://flox.dev/docs/man/flox-auth and the other flox-* man pages linked in each row, plus https://flox.dev/docs/llms.txt. Syntax changes between releases, so run flox <command> --help on the customer’s version before a live demo.

How to read this page

  • The --help grouping in the top-level man page is “local development, sharing environments, and administration” (https://flox.dev/docs/man/flox). The tables below split local development into manage, use, discover and modify so each table fits on a screen.
  • Environment commands take -d <path> for a directory, -r <owner>/<name> for a FloxHub environment, and -D for your default environment. With none of them, “the environment in the current directory or the active environment that was last activated is used” (https://flox.dev/docs/man/flox-install).
  • General options such as -v and -q “must be specified before the subcommand” (https://flox.dev/docs/man/flox).

Manage environments

CommandWhat it doesUseful flagsExampleMan page
flox initCreates a new empty environment in the current directory or on FloxHub; a .flox directory holds the metadata.-n <name>, -d <path>, --bare, --auto-setup, -r <owner>/<name>flox inithttps://flox.dev/docs/man/flox-init
flox envsLists environments known to the local registry; the last activated one is listed first.--active, --jsonflox envs --activehttps://flox.dev/docs/man/flox-envs
flox deleteDeletes all data for an environment; prompts first.-f (skips the prompt, “required for non-interactive use”), -dflox delete -f -d ./old-envhttps://flox.dev/docs/man/flox-delete
flox listLists packages installed in an environment.-n, -e, -a (increasing detail), -c, -uflox list -ahttps://flox.dev/docs/man/flox-list
flox generations listShows every generation you can switch to and which is live.--tree, --json, --no-pagerflox generations list -r acme/platformhttps://flox.dev/docs/man/flox-generations-list
flox generations rollbackMoves a FloxHub environment back one generation.-d, -rflox generations rollback -r acme/platformhttps://flox.dev/docs/man/flox-generations-rollback
flox generations switchSwitches to a named generation.<generation>, -d, -rflox generations switch 3 -r acme/platformhttps://flox.dev/docs/man/flox-generations-switch
flox generations historyPrints the change history of an environment.--json, -uflox generations history --no-pagerhttps://flox.dev/docs/man/flox-generations-history

Generations apply to environments on FloxHub: “every modification to the environment creates a new generation of the environment” (https://flox.dev/docs/man/flox-generations-list).

Use environments

CommandWhat it doesUseful flagsExampleMan page
flox activateConfigures a shell with the environment: packages on $PATH, variables, aliases, hooks, and optionally services. Has four modes: interactive, shell command, exec command and in-place.-c <cmd>, -- <cmd>, -r <owner>/<name>, -s, -m dev|run, -g <generation>, -tflox activate -r some_user/myenvhttps://flox.dev/docs/man/flox-activate
flox deactivateLeaves the innermost active environment; inside a flox activate subshell it is equivalent to exit.noneflox deactivatehttps://flox.dev/docs/man/flox-deactivate
flox runRuns a command from a Flox Catalog package without installing it.-p <package>, --reselectflox run -p cowsay -- cowsay "Hello, Flox!"https://flox.dev/docs/man/flox-run
flox services startStarts services declared in the manifest, one by name or all.<name>..., -d, -rflox services start serverhttps://flox.dev/docs/man/flox-services-start
flox services stopStops a named service or all running services.<name>...flox services stophttps://flox.dev/docs/man/flox-services-stop
flox services restartRestarts a named service or all.<name>...flox services restart myservicehttps://flox.dev/docs/man/flox-services-restart
flox services statusShows name, status and PID per service.--jsonflox services status myservicehttps://flox.dev/docs/man/flox-services-status
flox services logsShows service logs.--follow, -n <num>flox services logs --follow service1 service3https://flox.dev/docs/man/flox-services-logs
flox developEnters a development shell for a Nix expression build, used to iterate on a failing build.-c <cmd>, --stability, -dflox develop hellohttps://flox.dev/docs/man/flox-develop

Activating an environment from its cached lockfile “does not require a FloxHub account”; activating a private remote environment with -r requires login (https://flox.dev/docs/man/flox-activate). flox run fetches “by store path using substitution only” and does not yet support version constraints such as curl@8.0 (https://flox.dev/docs/man/flox-run).

Discover packages

CommandWhat it doesUseful flagsExampleMan page
flox searchFuzzy search of the Flox Catalog by pkg-path or description. Needs no FloxHub account.-a (all results, default at most 10), --jsonflox search ripgrep --jsonhttps://flox.dev/docs/man/flox-search
flox showShows description, outputs (defaults marked *) and available versions of one package. Needs no account.<pkg-path>flox show ripgrephttps://flox.dev/docs/man/flox-show

Modify environments

CommandWhat it doesUseful flagsExampleMan page
flox installAdds packages transactionally: the environment is built first, and if the build fails it is left unmodified. Needs a free FloxHub account.<pkg>@<version>, <pkg>^<outputs>, -i <id>, -d, -rflox install ripgrephttps://flox.dev/docs/man/flox-install
flox uninstall (alias rm)Removes packages.-d, -rflox uninstall ripgrephttps://flox.dev/docs/man/flox-uninstall
flox editEdits the manifest transactionally; the environment is rebuilt to validate the edit.-f <file> (non-interactive, - reads stdin), -n <name>, --sync, --resetflox edit -f manifest.tomlhttps://flox.dev/docs/man/flox-edit
flox upgradeUpgrades packages, or one package group such as toplevel.--dry-run, -d, -rflox upgrade --dry-runhttps://flox.dev/docs/man/flox-upgrade
flox include upgradeUpgrades included (composed) environments.<included environment>...flox include upgradehttps://flox.dev/docs/man/flox-include-upgrade
flox buildBuilds a package defined under [build] in the manifest; output lands at result-<package>.<package>..., -d, --stabilityflox build hellohttps://flox.dev/docs/man/flox-build
flox build cleanRemoves build artifacts.<package>...flox build cleanhttps://flox.dev/docs/man/flox-build-clean
flox build import-nixpkgsWrites .flox/pkgs/<name>/default.nix from a nixpkgs package.--force, --stabilityflox build import-nixpkgs hellohttps://flox.dev/docs/man/flox-build-import-nixpkgs
flox build update-catalogsUpdates catalog references for Nix expression builds.-dflox build update-catalogshttps://flox.dev/docs/man/flox-build-update-catalogs
flox containerizeExports the environment as a container image, to a runtime, a file or stdout.-f <file>, --runtime, --tag, --label, -m dev|runflox containerize --runtime dockerhttps://flox.dev/docs/man/flox-containerize

Install IDs default to the last attribute of the pkg-path, so python310Packages.pip becomes pip (https://flox.dev/docs/man/flox-install). The field reference for everything flox edit can change is https://flox.dev/docs/man/manifest.toml.

Share

CommandWhat it doesUseful flagsExampleMan page
flox pushSends an environment to FloxHub, or syncs local changes to a remote one; afterwards it is <owner>/<name>.-o <owner> (first push only), -r, -f (overwrite FloxHub)flox pushhttps://flox.dev/docs/man/flox-push
flox pullPulls an environment from FloxHub into a directory, or updates an existing one.<owner>/<name>, -c (copy), -g <generation>, -fflox pull acme/platformhttps://flox.dev/docs/man/flox-pull
flox publishUploads package metadata and copies the package so it is available in the Flox Catalog. Requires a clean, pushed git repo.-o <org>, --signing-private-key <path>, --stabilityflox publish hellohttps://flox.dev/docs/man/flox-publish

Push conflicts behave like git: running flox push from a different host may diverge, and “Passing --force” overwrites FloxHub with the local copy (https://flox.dev/docs/man/flox-push).

Administration

CommandWhat it doesUseful flagsExampleMan page
flox authFloxHub authentication: login, logout, status, token.login --token-file <path>flox auth statushttps://flox.dev/docs/man/flox-auth
flox configViews and sets configuration.-l, -r, --set <key> <value>, --delete <key>flox config --set auth_notifications falsehttps://flox.dev/docs/man/flox-config
flox gcGarbage collects data for deleted environments and runs garbage collection on the Nix store.noneflox gchttps://flox.dev/docs/man/flox-gc

Environment variables the man pages document

VariableWhat it doesSource
$FLOX_DISABLE_METRICSIf true, Flox does not submit basic metrics such as a token and the subcommand issued.https://flox.dev/docs/man/flox
$FLOX_MAX_PARALLEL_DOWNLOADSLimits parallel package downloads (default is all in parallel); set to 1 or more on poor connections.https://flox.dev/docs/man/flox
$EDITOR, $VISUALOverride the editor used for manifests and commit messages.https://flox.dev/docs/man/flox
$NIX_SSL_CERT_FILE, $SSL_CERT_FILETLS bundles; Flox never sets SSL_CERT_FILE, and sets NIX_SSL_CERT_FILE to its shipped bundle only if neither is set.https://flox.dev/docs/man/flox
$FLOX_SHELL, $SHELLChoose the shell for interactive, -c and in-place activation.https://flox.dev/docs/man/flox-activate
$FLOX_CONFIG_DIRDirectory holding flox.toml, the user config file.https://flox.dev/docs/man/flox-config

Config keys the man page documents

Set with flox config --set <key> <value> (https://flox.dev/docs/man/flox-config).

KeyMeaning
auto_activateprompt (default), allowlist or disabled.
auto_activate_environmentsPer-directory allow or deny; glob keys with * and ** are allowed.
disable_hookSkips the prompt hook; this also disables auto-activation and flox deactivate (default: false).
disable_metricsDisables usage metrics.
floxhub_tokenToken to authenticate on FloxHub.
search_limitHow many items flox search shows by default.
set_prompt, hide_default_promptControl the shell prompt.
trusted_environmentsKeys "<owner>/<name>" or "<owner>/*", values trust or deny.
upgrade_notifications, auth_notificationsAdvisory messages, default true.
installer_channelstable (default), nightly or qa.

All of these come from https://flox.dev/docs/man/flox-config.

Safe in scripts and agents

The Flox docs index tells AI coding assistants: “Do not run bare flox activate.” It names two non-interactive forms (https://flox.dev/docs/llms.txt):

flox activate -d <dir> -c '<command>'   # hooks and profile scripts applied; the preferred form
flox activate -d <dir> -- <command>     # exec mode; does not run profile scripts

Say: agents never run bare flox activate; they use -c or --. Ask: does your CI have a service account token, or a personal one? The man page accepts either (https://flox.dev/docs/man/flox-auth).

← POC and demo scripts · FAQ quickfire →