'nix develop' in a flake with overrides

EDIT: This is an “any way I can do it” question, so if there’s a “build a flake” way I can read about, great. If there’s a nix shell way I can do it, that’s great too. I’ll work with whatever approach you can point me toward.


I am attempting to do work on a git commit of the dwl project.

Though I can build git dwl using the overrides below, I have been wrestling and failing for days to set up a nix develop or nix shell environment in which I can actually do any work on the code.
I am unable thus far to even get wayland-scanner directly available in a nix shell environment. The “package” for wayland-scanner appears to be the package for wayland … which DEPENDS ON wayland-scanner??

Even
$ nix shell wayland-scanner
produces an environment in which
$ pkg-config --variable=wayland_scanner wayland-scanner
yields
Package wayland-scanner was not found in the pkg-config search path. )

I am not looking for someone to just solve the problem for me. I can read and learn, but so far, I just cannot find what to read to understand how to build a flake with the overrides that work in “normal” nix code. I cannot structure final: prev: inside a flake.nix in a fashion that does not error out.
Please point me toward documentation.

I wrote this set of overrides and it works well to build git dwl against git wlroots but I am unable to cram this into a flake.nix:

{
  config = {
    home.packages = with pkgs; [
      dwl
      (pkgs.writeScriptBin "startdwl" ''
        #!/usr/bin/env bash
        [[ -n $(${pkgs.kmod}/bin/lsmod | ${pkgs.gnugrep}/bin/grep nvidia) ]] && export WLR_NO_HARDWARE_CURSORS=1
        dwl -d > "${config.home.homeDirectory}"/.cache/dwltags 2>"${config.home.homeDirectory}"/.cache/dwl.log
      '')
    ];

    nixpkgs.overlays = [
      (final: prev: {
        dwl = (prev.dwl.override {
          conf = pkgs.concatText "dwl-config.h"
          [
            ./dwl_config_define_preface.h
            (
              pkgs.concatText "dwl-config-intermediate.h"
                [
                  (pkgs.writeText "dwl-hostname.h"
                    ("#define BUILD_HOST " + lib.strings.toUpper hostName + "\n")
                  )
                  ./dwl_config_body.h
                ]
            )
          ];
          wlroots = prev.wlroots.overrideAttrs (previousAttrs: rec {
            version                                = "git";
            src = prev.fetchFromGitLab {
              domain                               = "gitlab.freedesktop.org";
              owner                                = "wlroots";
              repo                                 = "wlroots";
              rev                                  = "2f3ea459";
              hash                                 = "sha256-6qhXItNSp5I5xH4SxmQ9GtO8D7+kncnKNo/oSuzr2gE=";
            };
          });
        }).overrideAttrs (previousAttrs: rec {
          version                                  = "wlroots-next";
          src = prev.fetchFromGitea {
            domain                                 = "codeberg.org";
            owner                                  = "fauxmight";
            repo                                   = "dwl";
            rev                                    = "931f6df";
            hash                                   = "sha256-d1fX0iwkQyVFpWuN7nzHiIwyrpqIpqhHb5n2ExrIGfQ=";
          };
        });
      })
    ];
  };
}