Skip to content

Basics

This is a rundown on how to use flox and its most common commands.

If you haven't already, please install flox before continuing.

$ flox search ripgrep
ripgrep - A utility that combines the usability of The Silver Searcher with the raw speed of grep
ripgrep-all - Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, and more
vgrep - User-friendly pager for grep/git-grep/ripgrep
Need more versions of the packages?

$ flox search ripgrep --verbose
ripgrep - A utility that combines the usability of The Silver Searcher with the raw speed of grep
  stable.nixpkgs-flox.ripgrep@13.0.0
  staging.nixpkgs-flox.ripgrep@13.0.0
  unstable.nixpkgs-flox.ripgrep@13.0.0

ripgrep-all - Ripgrep, but also search in PDFs, E-Books, Office documents, zip, tar.gz, and more
  stable.nixpkgs-flox.ripgrep-all@0.9.6
  staging.nixpkgs-flox.ripgrep-all@0.9.6
  unstable.nixpkgs-flox.ripgrep-all@0.9.6

vgrep - User-friendly pager for grep/git-grep/ripgrep
  stable.nixpkgs-flox.vgrep@2.5.5
  stable.nixpkgs-flox.vgrep@2.6.0
  stable.nixpkgs-flox.vgrep@2.6.1
  staging.nixpkgs-flox.vgrep@2.5.5
  staging.nixpkgs-flox.vgrep@2.6.0
  staging.nixpkgs-flox.vgrep@2.6.1
  unstable.nixpkgs-flox.vgrep@2.5.5
  unstable.nixpkgs-flox.vgrep@2.6.0
  unstable.nixpkgs-flox.vgrep@2.6.1
Packages are listed with the following naming convention:

<stability>/* (1)! */.<channel>/* (2)! */.<name>/*(3)!*/@<version>/*(4)!*/
  1. stability allows for previewing and testing package upgrades.

    When in doubt, always use the stable stability.

    Default stabilities are: stable, staging and unstable.

  2. channel is a place (eg. a GitHub repository) where records of package builds are collected. Most comonly each organization would have at least one channel.

    nixpkgs-flox is a flox channel that collects records of built packages from the NixOS/nixpkgs GitHub repository.

    Note: flox channels are not Nix channels.

  3. name is the name of a package in that channel.

  4. version points to a specific version of a package.

2. flox install - install packages

$ flox install ripgrep # (1)!
Installed 'ripgrep' package(s) into 'default' environment.
  1. By default packages get installed into the default environment.

    To better understand environments, please read the environments tutorial.

You can also install multiple packages at the same time.

$ flox install cowsay@3.04 unstable.fortune # (1)!
Installed 'cowsay@3.04', 'unstable.fortune' package(s) into 'default' environment.
  1. You can be as specific or as general as you want when installing packages.

    In this example we asked for: - a specific version (3.04) of cowsay - and for a fortune package from unstable stability.

3. flox remove - remove installed packages

$ flox remove ripgrep
Removed 'ripgrep' package(s) from 'default' environment."

4. flox list - list installed packages

$ flox list
local/aarch64-darwin.default
    Alias     default
    System    aarch64-darwin
    Path      /Users/USER/.local/share/flox/environments/local/aarch64-darwin.default
    Curr Gen  3

Packages
    0  stable.nixpkgs-flox.cowsay   3.04
    1  stable.nixpkgs-flox.fortune  mod-3.14.1

5. flox activate - activate flox environment

$ fortune | cowsay
bash: cowsay: command not found
bash: fortune: command not found

$ flox activate # (1)!

flox [default] $ fortune | cowsay
 ________________________
< Clones are people two. >
 ------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

flox [default] $ exit
$
  1. This will activate the default environment.

    flox supports multiple environments; see the tutorial on Environments to learn more.

Where to next?

We just scratched the surface of what flox can do.