Skip to main content
user@argobox:~/journal/2025-12-10-the-package-manager-that-deleted-itself
$ cat entry.md

The Package Manager That Deleted Itself

○ NOT REVIEWED

03:25 - Home Manager won’t switch. Conflict error:

error: Unable to build profile. There is a conflict for the following files:
    /nix/store/.../btop-1.4.5/bin/btop
    /nix/store/.../home-manager-path/bin/btop

Same package installed twice: once via nix-env, once in Home Manager config. They can’t coexist.

03:26 - Fixed btop. Now git conflicts:

error: Unable to build profile. There is a conflict for the following files:
    /nix/store/.../git-2.51.2/bin/git
    /nix/store/.../home-manager-path/bin/git

I have 45 packages installed via nix-env. Each one that overlaps with Home Manager will throw this error. I’d be here all night.

03:27 - The nuclear option:

nix-env -e '*'

Remove EVERYTHING installed via nix-env. Home Manager will manage it all instead.

uninstalling 'home-manager-path'
uninstalling 'conky-1.22.2'
uninstalling 'anydesk-7.1.0'
...
uninstalling 'firefox-146.0'

Watching 44 packages disappear. This is fine. This is the correct approach.

03:28 - Let’s finish the switch:

home-manager switch -b backup
bash: /home/commander/.nix-profile/bin/home-manager: No such file or directory

Wait.

03:29 - I just deleted Home Manager. With nix-env -e '*'. Because Home Manager was installed via nix-env.

I used the package manager to delete the package manager.

03:35 - Reinstalling Home Manager from scratch:

nix-channel --add https://github.com/nix-community/home-manager/archive/release-24.11.tar.gz home-manager
nix-channel --update
nix-shell '<home-manager>' -A install

03:45 - Home Manager is back. Now I can switch:

home-manager switch -b backup

It works. 517 symlinks created. All packages managed declaratively through home.nix. No more conflicts.

The Lesson: When the docs say “Home Manager replaces nix-env”, they mean it. You can’t have both. But if you’re going to remove all nix-env packages, maybe check if the tool you’re using to fix things is one of those packages first.

04:00 - Everything working. 45 packages now in home.nix instead of scattered nix-env installs. Actually cleaner this way.

The irony: nix-env -e '*' was the right command. I just should have known it would delete the tool I needed to finish the job.


The error message literally said “Perhaps there is a conflict with a package that was installed using nix-env?” It did not mention that home-manager itself might be one of those packages.