Best way to handle boot.extraModulePackages Kernel module conflict

Hey, I am having issues with Kernel module name conflicts and I am looking for advice on the best way to resolve it.

I’m trying to use boot.extraModulePackages to load the it87 module https://github.com/NixOS/nixpkgs/blob/ffaadc7b70686e25af496c5ec2c4491ad3656b94/pkgs/os-specific/linux/it87/default.nix . Below is what I have:

boot.extraModulePackages = with config.boot.kernelPackages; [
   it87
];

When I use this snippet it adds the the file it87.ko to /run/current-system/kernel-modules/lib/modules/6.1.35/kernel/drivers/hwmon/

The issue I have is the file /run/current-system/kernel-modules/lib/modules/6.1.35/kernel/drivers/hwmon/it87.ko.xz already exists and when I do a modprobe the it87.ko.xz seems to get used over the it87.ko which fails for me as the mainline version doesn’t support my hardware.

As a workaround I’ve added the below to my configuration.nix, disabling the mainline it87 module being built. This solves the problem but requires a long kernel compilation.

 boot.kernelPatches = lib.singleton {
    name = "disable-it87";
    patch = null;
    extraStructuredConfig = with lib.kernel; {
      SENSORS_IT87 = no;
    };
  };

Does anyone have a better solution? If https://github.com/NixOS/nixpkgs/blob/ffaadc7b70686e25af496c5ec2c4491ad3656b94/pkgs/os-specific/linux/it87/default.nix built a ko.xz extension I’m guessing it would overwrite the default and this would be a non issue?

1 Like

Hello!

Did you find any solution to this?

I have the following configuration but I am not able to load the it87 kernel module

  boot.kernelModules = [ "kvm-amd" "it87" ];
  boot.extraModulePackages = with config.boot.kernelPackages; [
    it87
  ];

And lsmod does not show it87 in any way

Thanks

I was not able to make it87 work
At this point I gave up on using it87 with fancontrol for my Gigabyte MB and set up the fans in the BIOS.

fancontrol is still used for the AMDGPU