Rebuilding system on unstable returns the error `error: `substituteAll` has been removed. Use `replaceVars` instead.`

Below is the error message I received and the command I used:

$ sudo nixos-rebuild switch --upgrade
building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin
         at /nix/store/598bwpbm79mn5d62byhsgh1wqn9b16c2-nixos/nixos/lib/attrsets.nix:1534:13:
         1533|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1534|             head values
             |             ^
         1535|           else

       … while evaluating the attribute 'value'
         at /nix/store/598bwpbm79mn5d62byhsgh1wqn9b16c2-nixos/nixos/lib/modules.nix:1084:7:
         1083|     // {
         1084|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1085|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/598bwpbm79mn5d62byhsgh1wqn9b16c2-nixos/nixos/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/store/598bwpbm79mn5d62byhsgh1wqn9b16c2-nixos/nixos/nixos/modules/system/boot/systemd.nix':

       … while evaluating the option `systemd.services.home-manager-fusion809.serviceConfig':

       … while evaluating definitions from `/nix/store/w6ix13llk4kb27l3hwxl0hd8kakvwj92-home-manager/home-manager/nixos':

       … while evaluating the option `home-manager.users.fusion809.home.activation.checkLinkTargets.data':

       … while evaluating definitions from `/nix/store/w6ix13llk4kb27l3hwxl0hd8kakvwj92-home-manager/home-manager/modules/files.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: `substituteAll` has been removed. Use `replaceVars` instead.

I am running NixOS unstable. My configuration files are here. sudo nix-channel --list returns:

home-manager https://github.com/nix-community/home-manager/archive/master.tar.gz
nixos https://nixos.org/channels/nixos-unstable

I last updated this system on the 25th of May 2025. I have done my own homework here and found this issue. But according to this issue’s final comment, file.nix had the error at line 84 (as it used pkgs.substituteAll instead of pkgs.replaceVars) and it’s been fixed. I am using the master branch and it doesn’t use pkgs.substituteAll and instead uses pkgs.replaceVars, like the error message says it’s meant to. So, I am somewhat stumped as to what I’m meant to do to fix this error…

1 Like

Just to be sure: how did you update your system?

I ran into this problem a week ago cause I always though sudo nixos-rebuild switch --upgrade would upgrade all the channels. But it only updates the nixos channel.
To update all channels you can do:

sudo nix-channel --update

Or if you want to update + rebuild + switch you can do:

sudo nixos-rebuild switch --upgrade-all
1 Like