Config with nerd-fonts built two days ago, now build failing with error "undefined variable 'nerd-fonts'"

Two days ago I did a rebuild and upgrade and was notified that the nerd-fonts config has changed. So I updated my config accordingly and successfully did a nixos-rebuild switch --upgrade. This upgraded my system from 24.11 unstable to 25.05 unstable.

However I’m doing it again today to make another unrelated config change (changing from mirrored boot drives to single boot drive), and now I’m getting a build error error: undefined variable 'nerd-fonts'.

My nerd-fonts config section and error below. Anyone know what could be going on? (using monolithic configuration.nix, flakes enabled but not used yet).

  fonts.packages = with pkgs; [
    font-awesome
    powerline-fonts
    powerline-symbols
    nerd-fonts.symbols-only
    nerd-fonts.fira-code
    nerd-fonts.droid-sans-mono
  ];
    error: undefined variable 'nerd-fonts'
    at /etc/nixos/configuration.nix:1030:5:
      1029|     powerline-symbols
      1030|     nerd-fonts.symbols-only
          |     ^
      1031|     nerd-fonts.fira-code

Edit: I’m getting the same error when running nixos-rebuild switch --upgrade on my second NixOS workstation. I did this same upgrade from 24.11 to 25.05 on the second workstation as the first one two days ago, both completed successfully. I haven’t made any changes to the second workstation’s config, it’s identical to the successful run two days ago, but it’s also getting this same nerd-font error as the first workstation.

What’s the output of nix-instantiate --eval --expr '(import <nixpkgs> {}).lib.version'?

EDIT: corrected command name

Thanks, it’s ‘not found’. Is there a package I need to include in config to get nix-eval?

bgibson@z11pa-d8:~
> nix-eval --expr '(import <nixpkgs> {}).lib.version'        
nix-eval: command not found

bgibson@z11pa-d8:~
> sudo nix-eval --expr '(import <nixpkgs> {}).lib.version'
sudo: nix-eval: command not found

Fwiw here’s the flake-related section of my config:

  nix = {
    settings.cores = 2;
    settings.auto-optimise-store = true;
    # garbage collect weekly
    gc = {
      automatic = true;
      dates = "weekly";
      options = "--delete-older-than 60d";
    };
    # enable flakes
    # garbage collect when less than 100MiB
    extraOptions = ''
      experimental-features = nix-command flakes 
      min-free = ${toString (100 * 1024 * 1024)}
      max-free = ${toString (1024 * 1024 * 1024)}
    '';
  };

I meant nix-instantiate --eval not nix-eval, whoops

Ah thx, here it is, seems it’s not found:

bgibson@z11pa-d8:~
> nix-instantiate --eval '(import <nixpkgs> {}).lib.version'       
error: path '/home/bgibson/(import <nixpkgs> {}).lib.version' does not exist

bgibson@z11pa-d8:~
> sudo nix-instantiate --eval '(import <nixpkgs> {}).lib.version'
[sudo] password for bgibson: 
error: path '/home/bgibson/(import <nixpkgs> {}).lib.version' does not exist

You have to keep the --expr as well. I’ve edited my initial reply.

Oh gotcha, thanks, here it is:

bgibson@z11pa-d8:~
> nix-instantiate --eval --expr '(import <nixpkgs> {}).lib.version'
"24.11.711349.394571358ce8"

Interesting it’s still on 24.11. Do I need to update that to 25.05 too?

This may be the problem:

bgibson@z11pa-d8:~
> nix-channel --list                                                                                          
nixos https://nixos.org/channels/nixos-unstable

bgibson@z11pa-d8:~
> sudo nix-channel --list
[sudo] password for bgibson: 
nixos https://nixos.org/channels/nixos-24.11

Changing the second to unstable and trying again.

I’d also delete your user channel, since what your system will build off is the root user’s nixos channel.

And of course a sudo nix-channel --update after you change the root user’s channel.

1 Like

That fixed the nerd-font error, thanks! Removed user nix-channel and updated admin channel. dry-build completes now, doing a full build now.