NixOS user overlays directory on darwin

The NixOS manual specifies:

A list of overlays placed into ~/.config/nixpkgs/overlays.nix will be automatically loaded by all nix tools.

Alternatively, you can put each overlay in its own .nix file under your ~/.config/nixpkgs/overlays directory.

However, nix-darwin uses ~/.nixpkgs/darwin-configuration.nix. Is there any overlays directory that gets auto-imported under nix-darwin, and if not, is there an idiomatic way to enable it?


There may be a better way to do this–I haven’t really revisited it since I pilfered the following from someone as a noob:

    nixpkgs.overlays =
    let path = ../.config/nixpkgs/overlays; in with builtins;
      map (n: import (path + ("/" + n)))
          (filter (n: match ".*\\.nix" n != null ||
                      pathExists (path + ("/" + n + "/default.nix")))
                  (attrNames (readDir path)));
1 Like