09:32 - Gentoo won’t log in. SDDM accepts my password, screen flashes, dumps me back to login. Every. Single. Time.
Wayland session? Flash. Back to login. X11 session? Flash. Back to login. Plasma? Flash. KDE? Flash. Hyprland? You guessed it.
10:15 - Checked .xsession-errors. Nothing useful. Just normal startup messages that stop abruptly.
Checked journalctl equivalent on OpenRC (spoiler: there isn’t one, use /var/log/messages). No smoking gun.
10:45 - Wait. I installed Nix last week. And Home Manager. To “try it out” alongside Gentoo’s package management.
Let me check what Home Manager did to my shell:
cat ~/.bashrc
There it is. Home Manager rewrote my entire .bashrc. It’s sourcing Nix profile scripts that set PATH, XDG_DATA_DIRS, and a dozen other environment variables.
11:20 - The Nix paths are being set before the session starts. SDDM reads .bashrc (or something that sources it), and suddenly my entire environment is pointing to Nix-managed binaries that don’t exist or aren’t compatible with my Gentoo session.
The fix? Remove Nix’s contamination from my shell configs:
# From TTY (Ctrl+Alt+F3)
mv ~/.bashrc ~/.bashrc.nix-backup
mv ~/.profile ~/.profile.nix-backup
# Recreate minimal bashrc
echo 'export PATH="/usr/local/bin:/usr/bin:/bin"' > ~/.bashrc
11:45 - Tried logging in again. IT WORKS.
SDDM → Plasma → Desktop. Like nothing ever happened.
The Lesson: Nix and Home Manager are designed to take over your environment. That’s the point. But if you’re running them alongside a traditional distro like Gentoo, they will happily rewrite your shell configuration and break session startup.
If you’re experimenting with Nix on an existing system:
- Don’t let Home Manager manage your shell unless you’re fully committed
- Keep backups of
.bashrc,.profile,.zshrcbefore installing - Know how to get to a TTY (Ctrl+Alt+F3) when your graphical session breaks
12:00 - System fully recovered. Nix is still installed but isolated. Home Manager is getting the “remove completely” treatment later today.
The contamination was subtle. The fix was simple. The three hours of debugging? Educational.
Home Manager’s default behavior is to manage your shell. It tells you this during setup. I clicked through it anyway. Past Me strikes again.