fonts.enableDefaultFonts

When running:

sudo nixos-rebuild switch --flake .#

I get recently started getting this:

trace: warning: The option `fonts.enableDefaultFonts' defined in `/nix/store/1rp9mgpy83k4w11gi58hqfcqhk3nnahp-source/flake.nix' has been renamed to `fonts.enableDefaultPackages'.

Any ideas?

You updated your nixpkgs input, which has renamed that option, just as the warning says. You’d do well to change the option in your config to the new name, as eventually this will become a failure.

I have the following as an input in my flake.nix:

nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

but I haven’t changed that recently. I don’t have a fonts.enableDefaultFonts option in my config. What is generating this message?

This PR introduced the change, about a month ago: nixos/fonts: rename fonts.fonts option to fonts.packages, other cleanups by SuperSandro2000 · Pull Request #244332 · NixOS/nixpkgs · GitHub

You just updated with nix flake update, you don’t need to change the input URL to get a new nixpkgs commit. This is all normal so far.

Hm, yeah, sucks when that happens. Sadly I don’t think the module system is currently capable of telling you exactly where the offending setting is set. Some other module helpfully sets this setting for you, and for one reason or another has not yet been updated to the new name. This can be for one of two reasons:

  1. You import a module from outside nixpkgs and this module has simply not caught up with the change yet. Remove external modules one by one and evaluate with nixos-rebuild build, then you should be able to spot it. Check with their upstream about fixing this.
  2. There’s a module lurking somewhere in nixpkgs that the PR author missed while changing the name, and was somehow not picked up by CI. If so, you can try disabling stuff that looks like it may set fonts until you find it.

If you want to not get caught by stuff like this in the future, use nixos stable and check the release notes when you upgrade to a new distro version.

1 Like

Aha. Good stuff there.

I don’t really have anything outside nixpkgs other than hyprland, so I assume that might be the culprit.

Yes: https://github.com/hyprwm/Hyprland/blob/5e7183daf514efb493bf812c71bf6de9153f5efd/nix/module.nix#L65

There was an attempt at fixing this here: NixOS module: check system version for fonts · hyprwm/Hyprland@bf0d8ab · GitHub

I don’t think the author of that commit quite understands system.stateVersion.

I created a PR to fix that, with any luck a nix flake update should fix this in the coming weeks: nix module: Fix attempted workaround for option name change by TLATER · Pull Request #3056 · hyprwm/Hyprland · GitHub

1 Like