Error: value is a Boolean while a set was expected on nix-os test

NixOS 22.11 (Raccoon) x86_64 on unstable channel

Hopefully I provide enough context, but full nix config is here for reference:

I’m getting this error when running

sudo nixos-rebuild test --flake “.#Entertainer

error: value is a Boolean while a set was expected

       at /nix/store/xx16m0bh181qgmfk6lw8h59ri2xv192v-source/lib/modules.nix:60:14:

           59|             (showDeclPrefix loc decl)
           60|             (attrNames decl.options)
             |              ^
           61|           )
(use '--show-trace' to show detailed location information)

I’m trying to create modules that I can enable for my different hosts. So far the only module is the one for git, located at /etc/nixos/modules/cli/git/default.nix.
Right now it looks like this:

{ pkgs, lib, config, ... }:
with lib;
let cfg = config.modules.cli.git;
  options.modules.cli.git = { enable = mkEnableOption "git"; };

  config = mkIf cfg.enable {
    programs.git.enable = true;

Whenever I put anything inside the brackets of

config = mkIf cfg.enable { }

It returns the error. If I leave it blank like shown above it builds like normal.

Why is it referring to a file outside of my config, if the problem is clearly caused by my config? Why is it asking for a boolean specifically? Even when I put something different in the brackets like

programs.git.enable = “foobar”;
environment.systemPackages = [ pkgs.git ];

It still complains about the value being a boolean.