flk activate
Enter the Nix development shell for your project.
flk activate
flk activate --profile backend
Options
-p, --profile <PROFILE>: Activate a specific profile instead of the default
Behavior
- Runs
nix develop .#<profile> --impureto enter the dev shell - Reuses a cached develop profile from
.flk/.nix-profile-<profile>when your flake config is unchanged - Refreshes that cached profile when
flake.nix,flake.lock, or the relevant.flkprofile files change - Uses standard profile resolution when
--profileis not specified - Custom commands and environment variables from the profile are available inside the shell
- Exports
FLK_FLAKE_REF/FLK_PROFILEinto the shell so the hook’srefresh/switchcommands know the active profile (flk global activateadditionally exportsFLK_ENV_DIR) - Exports
FLK_ORIG_PATH(the pre-activationPATH):refresh/switchreset to it so removed packages don’t linger in the inheritedPATH
Shell selection
The shell exec’d inside the dev environment is resolved in this order:
FLK_SHELLenvironment variable (explicit override)$SHELL, unless it points into/nix/store—nix develop/nix-shellexportSHELLas nixpkgs’ non-interactive bash, which breaks interactive terminals (missing completion, broken prompt)- The login shell from
/etc/passwd /bin/sh
The refresh/switch hook functions apply the same logic.
Notes
- For automatic environment switching when navigating between projects, add the shell hook:
eval "$(flk hook bash)" # or zsh/fish - For automatic activation when entering a directory, use direnv integration
See Also
- flk hook — for
refreshandswitchcommands - flk direnv — for automatic directory-based activation