Package from overlay can't be used in config

Hi again :wave:

I’m using the overlays-compat method from the wiki. It works for some packages, but I couldn’t manage to override awesome package.

Here is what I added:

self: super:
  myAwesome = super.awesome.overrideAttrs (old: rec {
    pname = "myAwesome";
    version = "git-20200802-7a759432";
    src = super.fetchFromGitHub {
      owner = "awesomeWM";
      repo = "awesome";
      rev = "7a759432d3100ff6870e0b2b427e3352bf17c7cc";
      sha256 = "0kjndz8q1cagmybsc0cdw97c9ydldahrlv140bfvl1xzhhbmx0hg";

And I use it like:

{ config, pkgs, ... }:
  services.xserver = {
    windowManager.awesome = {
      enable = true;
      package = pkgs.myAwesome;
      luaModules = [

It fails with following error on nixos-rebuild switch --upgrade:

unpacking channels...
building Nix...
building the system configuration...
error: attribute 'myAwesome' missing, at /home/gurkan/syncfolder/dotfiles/nixos/etc/nixos/modules/laptop/xserver.nix:9:17
(use '--show-trace' to show detailed location information)

Weird thing is: If I run nix-env -iA nixos.myAwesome, it starts building. Or going into nix repl, I can see it:

~> nix repl
Welcome to Nix version 2.3.6. Type :? for help.

nix-repl> :l <nixpkgs>
Added 11527 variables.


nix-repl> pkgs.myAwesome.src.urls
[ "" ]

Can someone hint what I’m missing :confused:

Have you added the overlay to your config?

Home-manager as well as nixos have the nixpkgs.overlays attribute.

Neither will pick up overlays automatically.