Troubleshooting
This page covers common issues and their solutions.
Nix Not Found
Symptom: command not found: nix or flk commands fail with Nix errors.
Solution:
- Ensure Nix is installed:
curl -L https://nixos.org/nix/install | sh - Verify installation:
nix --version - Enable flakes in
~/.config/nix/nix.conf:experimental-features = nix-command flakes - Restart your shell or run
source ~/.bashrc
Search/Version Lookup Errors
Symptom: flk search or flk add --version fails with network or evaluation errors.
Solution:
- These commands use
nix run github:vic/nix-versionswhich requires network access - Check your internet connection
- Try running directly:
nix run github:vic/nix-versions -- -p ripgrep - If behind a proxy, ensure Nix proxy settings are configured
Lock File Missing or Corrupted
Symptom: error: getting status of flake.lock: No such file or directory
Solution:
# Generate a new lock file
nix flake lock
# Or reinitialize the project
flk init --force
Shell Hook Not Working
Symptom: switch and refresh commands not available after activating.
Solution:
- Ensure the hook is in your shell profile:
# For bash (~/.bashrc) eval "$(flk hook bash)" # For zsh (~/.zshrc) eval "$(flk hook zsh)" # For fish (~/.config/fish/config.fish) flk hook fish | source - Restart your terminal or source your profile
- Verify with
type switch- it should show a function definition
Direnv Not Loading Environment
Symptom: Environment doesn’t activate when entering project directory.
Solution:
- Initialize direnv integration:
flk direnv init - Allow the
.envrcfile:direnv allow - Ensure direnv hook is in your shell profile
- Check
.envrcexists and containsuse flake
Package Not Found
Symptom: flk add <package> fails with “package not found”.
Solution:
- Search for the correct package name:
flk search <term> - For deep search with versions:
flk deep-search <package> - Package names in Nix may differ from common names (e.g.,
ripgrepnotrg)
Profile Errors
Symptom: “Profile not found” or profile-related errors.
Solution:
- List available profiles:
flk list profiles - Check
.flk/profiles/directory exists - Ensure profile names contain only alphanumeric characters, dashes, and underscores
Activation Fails
Symptom: flk activate or nix develop fails with evaluation errors.
Solution:
- Check for syntax errors in
.flk/profiles/*.nixfiles - Validate the flake:
nix flake check - Try updating inputs:
flk update - Check the error message for specific package or syntax issues
Container Export Issues
Symptom: flk export --format docker fails.
Solution:
- Ensure Docker/Podman is installed and running
- Check you have permissions to run container commands
- For Docker:
docker infoshould succeed - For Podman:
podman infoshould succeed