Difficulty understanding why an overlay does not work for a package in a NixOS configuration

I want to override the definition of noto-fonts-emoji. For the nixpkgs set I pass to lib.nixosSystem I use an overlay such as this:

      overlays.default = lib.composeManyExtensions [
        (_: prev: {
            noto-fonts-emoji = null;
        })

      ];

I also set the same overlay in my NixOS configuration in the nixpkgs.overlays without the lib.composeManyExtensions so that should not be a problem. Reason for duplicate overlaying is me just trying to debug why the overlay is not applied.

Now when I try to nixos-rebuild the configuration, I still see noto-fonts-emoji getting built. What I would like to understand is where does the package definition come from seeing as I overlay it to null twice. How can it still be getting built? I know there might be many different reasons for this but how would I go around finding this out? I can use nix-tree to see that it is a dependency of e.g. fc-cache but why does the overlay(s) not apply?

I have had similar confusions with other packages before and I always at a loss on how to debug these issues. In the same overlay I showed above I can override e.g. steam-run, which is in my environment.systemPackages and the overlay will apply.

noto-fonts-emoji is an alias not used anywhere in NixOS any more:

The attribute you are looking for is noto-fonts-color-emoji, which is used as the default emoji font on NixOS:

But the proper way to disable installing it is using the fonts.enableDefaultPackages = false; NixOS option. Just replacing a package with null can break other packages that rely on it – for example, twitter-color-emoji copies the build system from noto-fonts-color-emoji, and deltachat-desktop wants the TTF file.

1 Like