Second overlay not seeing changes from first

I created a custom derivation for simplifying macOS gui applications awhile back. However, I didn’t upstream it due to wanting to refine it a bit, and it seems my method of overlaying it onto nixpkgs is no longer working.

Relevant darwin-configuration.nix excerpt:

nixpkgs.overlays =
      ( final: prev: {
          darwin = prev.darwin // {
            installApplication = prev.callPackage overlays/installApplication.nix {};
      ( final: prev: {
        bitrise = prev.callPackage overlays/bitrise.nix {};
        carthage = prev.callPackage overlays/carthage.nix {};
        # ...

giving an error of:

while evaluating 'makeOverridable' at /nix/store/bxsfsmq1jcqd6xkawlw545g6r5cr62f2-nixpkgs-21.11pre318361.a3a23d9599b/nixpkgs/lib/customisation.nix:67:24, called from /nix/store/bxsfsmq1jcqd6xkawlw545g6r5cr62f2-nixpkgs-21.11pre318361.a3a23d9599b/nixpkgs/lib/customisation.nix:121:8:
while evaluating anonymous function at /Users/spease/.nixpkgs/overlays/carthage.nix:1:1, called from /nix/store/bxsfsmq1jcqd6xkawlw545g6r5cr62f2-nixpkgs-21.11pre318361.a3a23d9599b/nixpkgs/lib/customisation.nix:69:16:
attribute 'installApplication' missing, at /Users/spease/.nixpkgs/overlays/carthage.nix:3:1

Anyone know what the right way to add a field to nixpkgs.darwin is now?

It would be good if you also posted the full trace code of carthage.nix since that is where the error comes from.

Looking at pkgs/top-level/all-packages.nix:

The darwin attribute is defined in pkgs/top-level/darwin-packages.nix, which reveals it is a scope:

If you want to replace a scope, you should use its overrideScope' function, otherwise other packages inside will not be aware of the new package.

Now, this should not matter in your case since you are only using the attribute from outside of the scope but it is a good practice to use the proper overriding mechanism in case the requirements change in the future.

It is not actually clear to me why your code does not work but I have not actually looked into how splicing works, especially with overlays and scopes so maybe not using overrideScope can confuse the splicing mechanism.

This helps. It’s not really documented with the other overrides:

Seems to be a previous question:

But I did find a reasonable example:

Using that has gotten me to the type error again I mentioned in the other thread. If I just comment out meta.maintainers then I get:

building the system configuration...
error: value is a set while a list was expected

       at /nix/store/qwg6sqp8vy46mc3i4p90f51snfs7laxi-nixpkgs-22.11pre415372.7b06206fa24/nixpkgs/pkgs/stdenv/generic/check-meta.nix:53:34:

           52|   hasNoMaintainers = attrs:
           53|     attrs ? meta.maintainers && (lib.length attrs.meta.maintainers) == 0;
             |                                  ^
(use '--show-trace' to show detailed location information)


{ cpio, fetchurl, fixDarwinDylibNames, lib, stdenvNoCC, undmg, unpkg, unzip }:
{ description, homepage, license, maintainers, pname, sha256, url, version }:

stdenvNoCC.mkDerivation rec {
  inherit pname version;

  nativeBuildInputs = [ cpio fixDarwinDylibNames undmg unpkg unzip ];

  sourceRoot = ".";
  src = fetchurl {
    name = builtins.replaceStrings [ "%20" ] [ "-" ] (builtins.head (builtins.match ".*/([^/]+)" url));
    inherit url sha256;

  phases = [ "unpackPhase" "installPhase" ];

  installPhase = ''
      # .dmg files or compressed Applications
      app=( ./*.app )
      if [ ! -z "$app" ]; then
        mkdir -p $out/Applications
        mv -n "$app" $out/Applications/

      # .pkg files
      if [ -d "./usr/local" ]; then
        mv -n ./usr/local/* $out/

      if [ ! -L "./Applications" ] && [ -d "./Applications" ]; then
        mkdir -p $out/Applications
        mv -n ./Applications/*.app $out/Applications/

  meta = with lib; {
    description = description;
    homepage = homepage;
    license = licenses."${license}";
    # maintainers = forEach maintainers (x: maintainers."${maintainer}");
    platforms = platforms.darwin;

Error seems to happen even if I comment out the overlays that use installApplication.nix (without commenting them out in the system packages).

I also get an error about running out of memory, but apparently Firefox is using 16.8 GB so that’s my next troubleshooting step…

That sounds like not using overrideScope' was indeed the issue. I would suggest continuing the debugging in the other thread as to not split the attention of the community into multiple places for solving the same issue.

P.S. You will want to post more context, including the full trace and the place where buildApplication is actually used.