dustinlyons / nixos-config

General purpose Nix configuration for macOS / NixOS with starter templates + step-by-step guides ✨
BSD 3-Clause "New" or "Revised" License
1.78k stars 113 forks source link

Error - "The option definition `fonts.fontDir.enable' in <path> no longer has any effect; please remove it" ? #95

Closed victorhooi closed 4 months ago

victorhooi commented 5 months ago

I just ran nix flake update, then tried to do nix run ./#build-switch, and I got an error about fonts.fontDir.enable:

❯ nix run ./#build-switch
warning: Git tree '/Users/foobar/nixos-config' is dirty
Running build-switch for aarch64-darwin
Starting build...
warning: Git tree '/Users/foobar/nixos-config' is dirty
error:
       … while evaluating the attribute 'value'
         at /nix/store/5w7nhyvrgsa81h0kyifmbl6j97hvlzh5-source/lib/modules.nix:809:9:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          810|         inherit (res.defsFinal') highestPrio;

       … while calling the 'addErrorContext' builtin
         at /nix/store/5w7nhyvrgsa81h0kyifmbl6j97hvlzh5-source/lib/modules.nix:809:17:
          808|     in warnDeprecation opt //
          809|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |                 ^
          810|         inherit (res.defsFinal') highestPrio;

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

       error:
       Failed assertions:
       - The option definition `fonts.fontDir.enable' in `/nix/store/nqjhxcky0bi86plrrv1vc19ccd6ndz8f-source/hosts/darwin' no longer has any effect; please remove it.
       No nix-darwin equivalent to this NixOS option. This is not required to install fonts.

Do you know if something has changed there, with regards to fonts.fontDir.enable?

(My naive googling shows that this option is still mentioned at https://nixos.wiki/wiki/Fonts - but it's possible I'm mis-reading the error message above?)

dustinlyons commented 5 months ago

You'll experience many changes that occur in nixpkgs, nix-darwin, etc. over time. Generally, the message should be self-explanatory.

Sometimes they're not, and in those cases I'll go to the repo and check out open Issues. Generally if I update the flake and something is broken, it's broken for everyone.

Here, I would just search your configuration for that option and remove it. I'm sure I'll get the same message next time I update, and will have to do the same.

victorhooi commented 4 months ago

OK, so it seems this was an upstream change in nix-darwin (https://github.com/LnL7/nix-darwin/pull/754).

I'm surprised nobody else hit this issue when they run nix run ./#build-switch? Or is there some reason it would only affect me?

Anyhow, I've filed a PR to remove it from the starter templates =) - hopefully that's correct:

https://github.com/dustinlyons/nixos-config/pull/98

Kudos to the helpful folks here who helped me find it:

https://www.reddit.com/r/NixOS/comments/1dl3s36/buildswitch_complains_fontsfontdirenable_is/

Aside - this is kind of why I was curious about the correct workflow to pull in fixes in your upstream repo (https://github.com/dustinlyons/nixos-config/issues/82) - that way, we could still take advantage of improvements/fixes you push, but then have our own local changes/packages overlaid on top of that. For now I'm doing it the naive way, by just duplicating the changes locally as well.

dustinlyons commented 4 months ago

Closing as #98 was merged. Thanks again.