Then I did a nix-channel --update and a nixos-rebuild switch. Then, returning to my user:
ndt@blackbeta:~/ > home-manager switch
trace: warning: You are using
Home Manager version 23.11 and
Nixpkgs version 24.05.
Using mismatched versions is likely to cause errors and unexpected
behavior. It is therefore highly recommended to use a release of Home
Manager that corresponds with your chosen release of Nixpkgs.
If you insist then you can disable this warning by adding
home.enableNixpkgsReleaseCheck = false;
to your configuration.
/nix/store/p6fzy29qs5l3vj3j145jm5pxvwf8cx56-home-manager-generation
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating linkGeneration
Cleaning up orphan links from /home/ndt
No change so reusing latest profile generation 202
Creating home file links in /home/ndt
Activating onFilesChange
Activating reloadSystemd
trace: warning: You are using
Home Manager version 23.11 and
Nixpkgs version 24.05.
Using mismatched versions is likely to cause errors and unexpected
behavior. It is therefore highly recommended to use a release of Home
Manager that corresponds with your chosen release of Nixpkgs.
If you insist then you can disable this warning by adding
home.enableNixpkgsReleaseCheck = false;
to your configuration.
There are 84 unread and relevant news items.
Read them by running the command "home-manager news".
Oddly, it doesn’t block: it installs the home-manager update despite the warning!
Does anyone know how I can get this update to install?
Additional context
As root, I see channels in nix-channel --list. However, when my regular user runs this, no output is shown. Is that normal?
First I added the channel, then I ran nix-shell '<home-manager>' -A install.
I ran that command again, and it results in the following behavior:
ndt@blackbeta:~/ > home-manager --version
24.05
ndt@blackbeta:~/ > home-manager switch
trace: warning: You are using
Home Manager version 23.11 and
Nixpkgs version 24.05.
Using mismatched versions is likely to cause errors and unexpected
behavior. It is therefore highly recommended to use a release of Home
Manager that corresponds with your chosen release of Nixpkgs.
If you insist then you can disable this warning by adding
home.enableNixpkgsReleaseCheck = false;
to your configuration.
/nix/store/p6fzy29qs5l3vj3j145jm5pxvwf8cx56-home-manager-generation
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating linkGeneration
Cleaning up orphan links from /home/ndt
Creating profile generation 206
error: path '/home/ndt/.local/state/home-manager/gcroots/current-home' is not a valid garbage collector root; it's not in the directory '/nix/var/nix/gcroots'
Hah, nice! I imagine you have a programs.home-manager.enable set, so home-manager installs itself. This is all fine, the issue is that home-manager seems to be pulling from an old home-manager branch, despite your channels being up-to-date. The command you use to reinstall home-manager proves that (assuming you did not run that as root), because <home-manager> will grab home-manager from your $NIX_PATH.
That should also be used by home-manager, but it is not. So you must be pinning the home-manager version somewhere else - any chance you could share your home config?
31 # Let Home Manager install and manage itself.
32 programs.home-manager.enable = true;
33 programs.home-manager.path = "$HOME/src/github.com/nix-community/home-manager";
So when I update home-manager, I need to make sure that repo is checked out to the correct version:
ndt@blackbeta:~/src/github.com/nix-community/home-manager/ > git checkout release-24.05
Previous HEAD position was 652fda4c helix: remove outdated comment
branch 'release-24.05' set up to track 'origin/release-24.05'.
Switched to a new branch 'release-24.05'
Then:
$ nix-shell '<home-manager>' -A install
The file /home/ndt/.config/home-manager/home.nix already exists, leaving it unchanged...
Creating initial Home Manager generation...
/nix/store/is142yp0h87a75fy3jjcn646ic75ms3c-home-manager-generation
Starting Home Manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating linkGeneration
Cleaning up orphan links from /home/ndt
Creating profile generation 209
Creating home file links in /home/ndt
Activating onFilesChange
Activating reloadSystemd
There are 120 unread and relevant news items.
Read them by running the command "home-manager news".
All done! The home-manager tool should now be installed and you can edit
/home/ndt/.config/home-manager/home.nix
to configure Home Manager. Run 'man home-configuration.nix' to
see all available options.
And finally, things are better:
$ > home-manager --version
24.05
Thanks so much for the help - since I had both the .path variable and the release channel, it was confusing to understand how they interacted. Removing (or updating) programs.home-manager.path leads to the expected behavior.
Well, frankly, if you’re explicitly overriding the source of home-manager it shouldn’t be much of a surprise that it doesn’t magically know to use the original version after you update.
Setting that variable effectively makes the home-manager channel entry useless, I’d recommend removing one or the other to prevent confusion. That, or maybe remove both and add an explicit NIX_PATH entry for home-manager, using e.g.:
nix.nixPath = [
# I'm not actually sure if that $HOME resolves, maybe
# replace it with ${config.home.homeDirectory}
"home-manager:$HOME/src/github.com/nix-community/home-manager"
];
I honestly don’t know why home-manager has an option to forcibly override the home-manager path entry when there are proper ways to do it with nix… Seems like its only purpose is to confuse users.