{ lib, stdenv, fetchFromGitHub, kernel, kernelModuleMakeFlags, nix-update-script, }: stdenv.mkDerivation { pname = "nct6687d"; version = "0-unstable-2026-03-13"; src = fetchFromGitHub { owner = "Fred78290"; repo = "nct6687d"; rev = "cedda8bff09a4083e07414fb80fdc3901e7ab544"; hash = "sha256-+9gGpr004hKvvQeadTOwFe4gZvmx5bO1jWmlmt4NfSo="; }; setSourceRoot = '' export sourceRoot=$(pwd)/source ''; nativeBuildInputs = kernel.moduleBuildDependencies; makeFlags = kernelModuleMakeFlags ++ [ "-C" "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" "M=$(sourceRoot)" ]; buildFlags = [ "modules" ]; installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ]; installTargets = [ "modules_install" ]; passthru.updateScript = nix-update-script { extraArgs = [ "--version=branch=main" ]; }; meta = { description = "Kernel module for the Nuvoton NCT6687-R chipset found on many B550/B650 motherboards from ASUS and MSI"; license = lib.licenses.gpl2Only; homepage = "https://github.com/Fred78290/nct6687d/"; platforms = lib.platforms.linux; maintainers = with lib.maintainers; [ atemu ]; }; }