Nixpkgs and home-manager version mismatch warning

I was using Win11 WSL-Ubuntu 22.04 inside powershell, I installed stand alone home-manager v24.05 using curl and used Nixpkgs v24.05 channel. I am NOT using flakes but simple home-manager with nixpkgs channels. Afterwards, I had to upgrade my channels to 25.05 so I used the following steps:

$ nix-channel --add https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz home-manager
$ nix-channel --add https://nixos.org/channels/nixos-25.05 nixpkgs
$ nix-channel --update
$ home-manager switch

$ nix-env --install --attr nixpkgs.nix
$ home-manager switch

Now if I check the versions, I get:

$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz
nixpkgs https://nixos.org/channels/nixos-25.05

But if I check the version like:

$ nix-shell --packages nix-info --run "nix-info --host-os --markdown --sandbox"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.87.2-microsoft-standard-WSL2, Ubuntu, 22.04.4 LTS (Jammy Jellyfish), nobuild`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.28.4`
 - nixpkgs: `/nix/store/lss63wpqkrj36ivsmskivdnk2m5df5a0-source`

I get the following warning:

trace: warning: You are using

  Home Manager version 25.05 and
  Nixpkgs version 25.11.

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.

I don’t understand why my nixpkgs is NOT 25.05. How can I ensure that my nixpkgs is at stable v25.05 in order to avoid the version mismatch warnings?

Firstly I’m kind of suspicious of this command. Is this really the recommended way to upgrade your Nix installation?

Can you run sudo nix-channel --list instead? IIRC the Nix daemon will only see the root-defined channels, and your commands seem to have been run as a user (I’m assuming due to the usage of $ in your snippet).

Can you please share the output of printenv NIX_PATH?

NIX_PATH, not $NIX_PATH. printenv does not take the leading $.

$ nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-25.05.tar.gz
nixpkgs https://nixos.org/channels/nixos-25.05
$ printenv $NIX_PATH

SHELL=/bin/bash
__HM_SESS_VARS_SOURCED=1
WSL2_GUI_APPS_ENABLED=1
WSL_DISTRO_NAME=Ubuntu
WT_SESSION=b6db03c3-72eb-4d72-953f-904cf3a906a7
XDG_DATA_HOME=/home/username/.local/share
XDG_CONFIG_HOME=/home/username/.config
LOCALE_ARCHIVE_2_27=/nix/store/kinw6v4gh5pxa9dvld5ksxgv5887300d-glibc-locales-2.40-66/lib/locale/locale-archive
CROC_SECRET=Win11wsl_12i5
GNUPGHOME=/home/username/.gnupg
GPG_TTY=/dev/pts/4
NAME=win11username
PWD=/mnt/c/Users/usernamew11
NIX_PROFILES=/nix/var/nix/profiles/default /home/username/.nix-profile
LOGNAME=username
HOME=/home/username
LANG=C.UTF-8
WSL_INTEROP=/run/WSL/89337_interop
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:
WAYLAND_DISPLAY=wayland-0
NIX_SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
XDG_CACHE_HOME=/home/username/.cache
LESSCLOSE=/usr/bin/lesspipe %s %s
TERM=xterm-256color
LESSOPEN=| /usr/bin/lesspipe %s
USER=username
DISPLAY=:0
SHLVL=1
XDG_STATE_HOME=/home/username/.local/state
XDG_RUNTIME_DIR=/run/user/1000/
WSLENV=WT_SESSION:WT_PROFILE_ID:
XDG_DATA_DIRS=/usr/local/share:/usr/share:/home/username/.nix-profile/share:/nix/var/nix/profiles/default/share:/var/lib/snapd/desktop
PATH=/home/username/bin:/home/username/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/PowerShell/7:/mnt/c/ProgramData/scoop/shims:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/usernamew11/scoop/apps/gpg4win/current/GnuPG/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Kraken Desktop/:/mnt/c/Program Files/PowerShell/7/:/mnt/c/Users/usernamew11/scoop/apps/dotnet-sdk/current:/mnt/c/Users/usernamew11/go/bin:/mnt/c/Users/usernamew11/AppData/Roaming/npm:/mnt/c/Users/usernamew11/scoop/apps/libvips/current/bin:/mnt/c/Users/usernamew11/scoop/apps/gpg4win/current/GnuPG/bin:/mnt/c/Users/usernamew11/scoop/apps/gpg4win/current/Gpg4win/bin:/mnt/c/Users/usernamew11/scoop/apps/vscodium/current/bin:/mnt/c/Users/usernamew11/scoop/apps/rustup-msvc/current/.cargo/bin:/mnt/c/Users/usernamew11/AppData/Local/pnpm:/mnt/c/Users/usernamew11/scoop/shims:/mnt/c/Users/usernamew11/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/usernamew11/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/usernamew11/AppData/Roaming/Programs/Zero Install:/mnt/c/Users/usernamew11/.dotnet/tools:/mnt/c/Users/usernamew11/AppData/Local/Microsoft/WindowsApps:/snap/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
HOSTTYPE=x86_64
PULSE_SERVER=unix:/mnt/wslg/PulseServer
WT_PROFILE_ID={574e775e-4f2a-5b96-ac1e-a2962a402336}
_=/usr/bin/printenv

printenv NIX_PATH
does NOT return any value – it returns a blank.

That implies it’s not set.

Thanks, you’re right.
echo $NIX_PATH
also returns blank

So:

  1. What must be the value of NIX_PATH?
  2. Is a user supposed to set it up manually?
  3. Is it supposed to be set up automatically at the time of Nix installation and did I miss any step?
  4. Where in the Nix docs is it listed as to what value of NIX_PATH to ensure?

How did you install nix?

1 Like

Then please show nix config print nix-path, might as well be show or whatever I never remember what verb was used here.

$ nix config show nix-path
says
nixpkgs=flake:nixpkgs

on my WSL based machine with the problem.

On my other machine, LMDE6, I did an upgrade of nix and it went smooth but on this good machine the above command shows blank and the printenv NIX_PATH also returns blank

I used the DeterminateSystems install script to install on this problem machine - WSL.

I used Nix official install instructions to install on good working smooth Nix upgrade machine - LMDE6

IIRC they create a nix config by default that maps nix path to flakes.

Please see /etc/nix/nix.conf and check if it has a nix-path entry. If it exists remove it.

Thanks.
The file /etc/nix/nix.conf does NOT have nix-path entry but it has 2 similar entries:
extra-nix-path = nixpkgs=flake:nixpkgs
upgrade-nix-store-path-url = https://install.determinate.systems/nix-upgrade/stable/universal

So which entry do I remove?

extra-nix-path appends to nix-path, it’s functionally the same here.

I experimented with my local Ubuntu. It has the same entry and nothing else.

Just dropping the line will break nix path lookup completely.

My “nix on ubuntu” behaves completely different with nix-path completely being unset in the nix.conf.

The nix on Ubuntu was originally installed via the detsys installer though I am using a master built nix for everyday use.

Using the detsys installed 2.18, which still lingers for the daeom in the background gives me a sensible output for the nix path. Though a new one doesn’t.

So I did a very brief “bisection” on this issue:

❯ nix run nix/2.25.0 -- config show nix-path
nixpkgs=flake:nixpkgs
❯ nix run nix/2.22.0 -- config show nix-path
/home/nmelzer/.nix-defexpr/channels nixpkgs=flake:nixpkgs
❯ nix run nix/2.24.0 -- config show nix-path
nixpkgs=flake:nixpkgs
❯ nix run nix/2.23.0 -- config show nix-path
/home/nmelzer/.nix-defexpr/channels nixpkgs=flake:nixpkgs

Somewhen between 2.23 and 2.24 the mechanism changed. For now, the easiest fix I see is to manually add nix-path = /home/username/.nix-defexpr/channels to ~/.config/nix/nix.conf to make this work again and the system usable.

I sadly do not have the time for an indepth bisection, the time I have at this computer is limited.

I was able to get hands on another affected system and bisect the culprit and created an issue.

Not including the users default channel location in the default nix-path setting is a bug in my opinion.

This probably has been missed so far just because no one uses channels anymore really…

1 Like

Thanks.
Trick seems to have worked.
If Nix flakes is stable enough then would you recommend I move to nix flakes for my future Nix home-manager setups instead of Nix channels?

Flakes are explicitly still experimental, so breaking changes do happen. Still, channels have their own UX issues, so pick what suits your workflow.

1 Like