Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

FAQ

General

What is flk?

A CLI for Nix flake dev environments. It manages packages, environment variables and custom commands so you don’t edit Nix files by hand.

Does flk work without Nix?

No, it needs Nix with flakes enabled. On machines without Nix, use an image built with flk export --format docker.

What Nix version do I need?

2.4 or later, with nix-command and flakes enabled.

Environment management

How do I reload or change profile without leaving the shell?

With the shell hook installed, refresh reloads the environment after changes and switch <profile> moves to another profile. Both work only inside an activated environment.

How do I pin a package version?

flk add ripgrep --version 14.1.0

The pin goes into .flk/pins.nix, together with the nixpkgs commit that has that version.

Can I have multiple profiles in one project?

Yes. Profiles live in .flk/profiles/, one file each. The default is defaultProfile in .flk/config.nix (defaultShell in .flk/default.nix on the legacy layout). Change it with flk profile set-default <name>.

How do I see what’s in the environment?

flk list           # packages
flk command list   # custom commands
flk env list       # environment variables
flk show           # everything

Updates and lock files

Can I preview updates?

flk update --show prints the diff and then restores the original flake.lock.

How do I restore a previous lock file?

Backups are in .flk/backups/:

flk lock restore <backup-name>   # or: flk lock restore latest

What does flk update do?

It backs up flake.lock, then runs nix flake update.

Integration

Can I use flk with direnv?

Run flk direnv init, then direnv allow. The environment loads when you enter the directory.

Does flk work with VS Code or other editors?

flk doesn’t depend on an editor. In VS Code, the direnv extension picks up the environment once flk direnv init is set up.

Can I export the environment to a container?

flk export --format docker
flk export --format podman
flk export --format json     # writes flake.json

Troubleshooting

Why can’t flk find my package?

The nixpkgs name may differ from the common one. Find it with flk search <term>, or list versions with flk deep-search <package>.

Why isn’t my shell hook working?

Check the hook is in your rc file and open a new shell. switch and refresh only exist inside an activated flk environment.