-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Hi everyone,
I'm using Home Manager with the Standalone installation method (not NixOS module), and I'm experiencing an issue where the Nix environment is not being loaded automatically in my shell configurations.
My Setup
- Installation method: Standalone Home Manager
- Shells: bash and zsh (both enabled in home.nix)
- Issue: After running
home-manager switch, the generated shell configurations don't automatically load the Nix environment, making allnixcommands unavailable
My Configuration
In my home.nix, I have:
programs.bash = {
enable = true;
enableCompletion = true;
};
programs.zsh = {
enable = true;
enableCompletion = true;
};The Problem
After applying this configuration, when I open a new shell session, I cannot use any Nix commands (like nix-shell, nix-env, etc.) because the Nix environment is not loaded.
My Question
According to the official documentation, I expected that enabling these programs would automatically set up the Nix environment. However, it seems like I need to manually add the Nix daemon initialization script to my shell configuration.
Is this the expected behavior for Standalone installations? Should I manually add the following to initExtra?
initExtra = ''
if [ -e "$HOME/.nix-profile/etc/profile.d/nix.sh" ]; then
. "$HOME/.nix-profile/etc/profile.d/nix.sh"
fi
'';Or is there a better/recommended way to ensure the Nix environment is properly loaded when using Home Manager in Standalone mode?
Thanks in advance!