Getting Started
1. Create the project
Run the init command in the selected project dir and wait for flk to generate the baseline structure. Either let flk detect your toolchain or force a specific template to be used during init as seen below.
flk init # detects the project type
flk init --template rust # or pick one: rust, python, node, go, generic
Detection is described in Project Templates.
2. Add packages
First you can search for any packages needed. Search subcommand shows packages matching the given name using a fuzzy search. Deep-search looks for a specific (literal) package name and provides the available versions that could be pinned to.
Add any packages you need to your environment. This can take a while on first run since nix needs to build the index prior to the addition, so that packages can be verified.
flk search ripgrep
flk deep-search ripgrep # available versions
flk add ripgrep
flk add ripgrep --version 15.1.0 # pinned
3. Add commands and environment variables
Commands are basically shell functions that will only be available inside your flk env. Env vars are exported and used as normal .env files. But do not add any PRIVATE keys. Environment variables in flk are committed as they follow the profile, so make sure to keep that in mind.
flk command add test "cargo test --all"
flk env add DATABASE_URL "postgresql://localhost/mydb"
flk env list
flk env remove DATABASE_URL
4. Enter the environment
This can also take some time as nix will need to pull all the packages from the cache, and in some specific cases, build them.
flk activate
test
5. Shell completions
This is completely optional, but completions are available following the steps below.
flk completions # print the script
flk completions --install # install it for the detected shell
6. direnv (optional)
If you want to use direnv to activate your flk environment, please use the provided flk commands below to set and unset the connection.
flk direnv init # new .envrc
flk direnv attach # existing .envrc
flk direnv detach
7. Shell hook (optional)
The hook adds refresh and switch inside the environment. Setup is on the flk hook page.
Next: Core Concepts, Commands.