Core Concepts
Projects
A flk project is a directory with a flake.nix. Profiles live in .flk/profiles/, and flake.nix loads them when you activate the environment.
flk init
Profiles
A profile is a set of packages, commands and environment variables stored in .flk/profiles/<name>.nix. With the shell hook installed, switch moves between profiles.
flk profile add backend
Custom commands
Custom commands are shell functions defined in a profile. They are available in the shell once the environment is active.
flk command add test "cargo test --all"
Environment variables
Environment variables are defined in a profile and exported when the environment is activated. They do not affect your global environment.
Warning: Do not store secrets in plain text in profile files, especially if the project is shared or version-controlled.
flk env add DATABASE_URL "postgres://localhost/dev"
Lock files
flake.lock records the exact input revisions, so the same environment can be rebuilt later or on another machine. flk update backs it up before updating, and flk lock lets you inspect and restore backups.
flk lock history
Overlays
Overlays modify existing packages or add new ones to the Nix package set. flk uses them for version pins, which are recorded in .flk/pins.nix alongside the lock file.
flk add ripgrep --version 14.1.0
Shell integration
The shell hook adds refresh and switch commands. They reload the environment or change profile without leaving the shell.
eval "$(flk hook bash)"
direnv integration
flk direnv init writes a .envrc that loads the flk environment when you enter the project directory. flk direnv attach and flk direnv detach manage it afterwards.
flk direnv init
Container exporting
flk export builds a Docker or Podman image from your environment, including packages, commands and environment variables. It is useful where flk itself is not available.
flk export --format docker