same issue as this Issue building linux kernel modules after Flake update
tldr there was a regression that broke building with nix 2.18.5, you can use a nix-shell like the following to build the configuration with a newer version of nix then swap to the resulting config:
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") { } }:
pkgs.mkShell {
packages = with pkgs; [
nixVersions.latest
];
}