diff --git a/config/btusb-add-mt7925.patch b/config/btusb-add-mt7925.patch new file mode 100644 index 0000000..ca50842 --- /dev/null +++ b/config/btusb-add-mt7925.patch @@ -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 }, diff --git a/config/btusb.nix b/config/btusb.nix new file mode 100644 index 0000000..1e61fc2 --- /dev/null +++ b/config/btusb.nix @@ -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; + }; +} diff --git a/maskiner/jobb/configuration.nix b/maskiner/jobb/configuration.nix index 605dc42..8cdebd8 100644 --- a/maskiner/jobb/configuration.nix +++ b/maskiner/jobb/configuration.nix @@ -9,7 +9,11 @@ pkgs, myhostname, ... -}: { +}: +let + btusb = pkgs.callPackage ../../config/btusb.nix { inherit (config.boot.kernelPackages) kernel; }; +in +{ imports = [ # Include the results of the hardware scan. ./hardware-configuration.nix @@ -22,19 +26,18 @@ ../../config/sway.nix ]; - # services.greetd = { - # enable = true; - # settings = { - # default_session = { - # command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd hyprland"; - # user = "greeter"; - # }; - # }; - # }; - # Bootloader. boot.loader.systemd-boot.enable = 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; [ nerd-fonts.comic-shanns-mono