Integration of flox with home-manager


I am new to flox and am excited by the possibilities to create and share reproducible environments for the scientific research I conduct. I am a NixOS user and an using home-manager to manage my dotfiles.

However, the flox documentation indicates that shell files, such as .zshrc, are modified or replaced by flox. I am wondering how I can integrate flox into my current environment without losing settings I specified through my home.nix file.

Is it simply a matter of adding a specification to my nix file such that eval "$(flox activate)" is added to .zshrc?

Thank you for your help.

You can use flox in a few ways. Using flox should not conflict or impede the usage of home-manger.

manage your user’s default environment

This interacts with home-manager because you are using both to achieve a similar outcomes. You will want to integrate them in some way. The eval $(flox activate) approach in the users’ .zshrc is perfectly reasonable and should work well. Add that to your home-manager settings and it should work well.

The flox installer should not change your user’s zshrc, so this should not be a conflict.

project-specific environments or ad-hoc

In this case, there is no conflict with home-manager. Running a flox activate will not disable or conflict with home-manager settings.

Thank you. That was very helpful.