How to pin/select the kernel version for linuxPackages_zen?

I want to use the apfs kernel driver (to access an old hackintosh partition on the host) with the zen kernel, but it appears to break on every minor version update. (Same with ddcci-driver apparently, not sure why the interface changes so often?).

So I thought I’d just somehow override with a fixed version, but it wasn’t so easy, and different from this post because the zen kernel packages attributes are themselves generated by a function.

I arrived at this but it doesn’t work yet

    kernelPackages = with pkgs; (linuxKernel.kernels.zenKernels {
      kernelPatches = [
        kernelPatches.bridge_stp_helper
        kernelPatches.request_key_helper
      ];
      zenVariant = { # here the actual target is selected based on what's available at https://github.com/zen-kernel/zen-kernel/releases
        version = "6.4.12"; #zen
        suffix = "zen1"; #zen
        sha256 = "1xxznqkgn27sh134c4szjhk8im342zh7z6200k3csnqd9fink2r7"; #zen
        isLqx = false;
      };
    }).zen;

but it gives me

       error: attribute 'extend' missing

Any ideas?

I use ddcci-driver and this drives me nuts. Figured it out today:

{ lib, pkgs, ... }:

{
  boot.kernelPackages = let
    version = "6.6.1";
    suffix = "zen1"; # use "lqx1" for linux_lqx
  in pkgs.linuxPackagesFor (pkgs.linux_zen.override {
    inherit version suffix;
    modDirVersion = lib.versions.pad 3 "${version}-${suffix}";
    src = pkgs.fetchFromGitHub {
      owner = "zen-kernel";
      repo = "zen-kernel";
      rev = "v${version}-${suffix}";
      sha256 = "13m820wggf6pkp351w06mdn2lfcwbn08ydwksyxilqb88vmr0lpq";
    };
  });
}

Note, there are newer pre-v6.8 versions (have a look at the commit history), but this one is in the NixOS binary cache, so that’s the one I picked for now.