Added a kernel module

Added new nix expr

Added patch

Updated

Updated patch

Renamed variables, bluetooth works on mt7925 now
This commit is contained in:
fwastring 2025-09-04 13:48:41 +02:00
parent 1fc6785205
commit 7c221331d6
3 changed files with 59 additions and 11 deletions

View file

@ -0,0 +1,11 @@
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -725,6 +725,8 @@ static const struct usb_device_id quirks_table[] = {
BTUSB_WIDEBAND_SPEECH },
{ USB_DEVICE(0x13d3, 0x3630), .driver_info = BTUSB_MEDIATEK |
BTUSB_WIDEBAND_SPEECH },
+ { USB_DEVICE(0x2c7c, 0x7009), .driver_info = BTUSB_MEDIATEK |
+ BTUSB_WIDEBAND_SPEECH },
/* Additional Realtek 8723AE Bluetooth devices */
{ USB_DEVICE(0x0930, 0x021d), .driver_info = BTUSB_REALTEK },

34
config/btusb.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, lib, kernel ? pkgs.linuxPackages_latest.kernel}:
pkgs.stdenv.mkDerivation {
pname = "btusb-kernel-module";
inherit (kernel) src version postPatch nativeBuildInputs;
kernel_dev = kernel.dev;
kernelVersion = kernel.modDirVersion;
# The key change is here: point to the correct module path for btusb.
modulePath = "drivers/bluetooth";
buildPhase = ''
BUILT_KERNEL=$kernel_dev/lib/modules/$kernelVersion/build
cp $BUILT_KERNEL/Module.symvers .
cp $BUILT_KERNEL/.config .
cp $kernel_dev/vmlinux .
make "-j$NIX_BUILD_CORES" modules_prepare
make "-j$NIX_BUILD_CORES" M=$modulePath modules
'';
installPhase = ''
make \
INSTALL_MOD_PATH="$out" \
XZ="xz -T$NIX_BUILD_CORES" \
M="$modulePath" \
modules_install
'';
meta = {
description = "btusb kernel module";
license = lib.licenses.gpl3;
};
}

View file

@ -9,7 +9,11 @@
pkgs, pkgs,
myhostname, myhostname,
... ...
}: { }:
let
btusb = pkgs.callPackage ../../config/btusb.nix { inherit (config.boot.kernelPackages) kernel; };
in
{
imports = imports =
[ # Include the results of the hardware scan. [ # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
@ -22,19 +26,18 @@
../../config/sway.nix ../../config/sway.nix
]; ];
# services.greetd = {
# enable = true;
# settings = {
# default_session = {
# command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd hyprland";
# user = "greeter";
# };
# };
# };
# Bootloader. # Bootloader.
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
hardware.enableRedistributableFirmware = true;
boot.extraModulePackages = [
(btusb.overrideAttrs (_: {
patches = [ ../../config/btusb-add-mt7925.patch ];
}))
];
fonts.packages = with pkgs; [ fonts.packages = with pkgs; [
nerd-fonts.comic-shanns-mono nerd-fonts.comic-shanns-mono