{ stdenv
, lib
, kernel
, kmod }: stdenv.mkDerivation rec {
  name = "ac71-${version}-${kernel.version}";
  version = "2024.2.13";

  # adapted from https://github.com/pobrn/qc71_laptop
  src = ./.;

  hardeningDisable = [ "pic" "format" ];
  nativeBuildInputs = kernel.moduleBuildDependencies;

  makeFlags = [
    "KERNELRELEASE=${kernel.modDirVersion}"
    "KERNEL_DIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
    "INSTALL_MOD_PATH=$(out)"
  ];
}
