Emacs overlay usage - error: "attribute ... missing"

I am introducing the emacs overlay to my configuration flake, but have run up against a problem with this error:

error: attribute 'emacsWithPackagesFromUsePackage' missing

       at /nix/store/hqrnx1kmyrgpjsslgc4c3fr0nyq24mk2-source/home/paul/features/emacs/default.nix:3:11:

            2| let
            3|   emacs = pkgs.emacsWithPackagesFromUsePackage {
             |           ^
            4|     package = pkgs.emacsUnstable;
(use '--show-trace' to show detailed location information)

I believe I have followed the instructions correctly to configure the overlay properly.

  • I have included the overlay as an input in my flake:
    emacs-overlay = {
      url = "github:nix-community/emacs-overlay";
    };
  • I have added the overlay to nixpkgs:
  nixpkgs = {
    overlays = ( builtins.attrValues outputs.overlays) ++ 
               [ inputs.emacs-overlay.overlay ];
    config = {
      allowUnfree = true;
    };
  };
  • I have called the missing function in my home manager emacs module:
{ pkgs, config, lib, ... }: 
let
  emacs = pkgs.emacsWithPackagesFromUsePackage {
    package = pkgs.emacsUnstable;
    config = ./init.el;
    extraEmacsPackages = epkgs: with epkgs; [
      use-package
    ];
    overrides = final: _prev: {
      nix-theme = final.callPackage ./theme.nix { inherit config; };
    };
    alwaysEnsure = true;
  };
in {
  home.packages = [ emacs ];
  home.file.".emacs.d/init.el".text = builtins.readFile ./init.el;
  home.file.".emacs.d/early-init.el".text = builtins.readFile ./early-init.el;
  home.file.".emacs.d/lisp/my-org-mode.el".text = builtins.readFile ./lisp/my-org-mode.el;

  services.emacs = {
    enable = true;
    client.enable = true;
    defaultEditor = lib.mkDefault true;
    socketActivation.enable = true;
  };
}

The full configuration is here. It is modeled on Misterio77’s config (Thanks Gabriel), but any errors are mine, not his!

I would love some pointers as to where to look for the problem.

Thanks in advance for reading and commenting!

Following some direction on matrix, this has now been resolved. My configuration is setup with home manager as a separate module. My addition of the overlay as an input above covers the system build, but not the home manager part - I needed to add the overlay to the home manager nixpkgs definition.