diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index a3f2d6bd6d95..b413d9a140b3 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -10276,6 +10276,13 @@ githubId = 6047658; name = "Ryan Horiguchi"; }; + rhysmdnz = { + email = "rhys@memes.nz"; + matrix = "@rhys:memes.nz"; + github = "rhysmdnz"; + githubId = 2162021; + name = "Rhys Davies"; + }; ribose-jeffreylau = { name = "Jeffrey Lau"; email = "jeffrey.lau@ribose.com"; diff --git a/nixos/modules/hardware/all-firmware.nix b/nixos/modules/hardware/all-firmware.nix index 99bdb11b0112..5b60b17312f9 100644 --- a/nixos/modules/hardware/all-firmware.nix +++ b/nixos/modules/hardware/all-firmware.nix @@ -83,6 +83,7 @@ in { b43Firmware_5_1_138 b43Firmware_6_30_163_46 b43FirmwareCutter + xow_dongle-firmware ] ++ optional pkgs.stdenv.hostPlatform.isx86 facetimehd-firmware; }) (mkIf cfg.wirelessRegulatoryDatabase { diff --git a/nixos/modules/hardware/xone.nix b/nixos/modules/hardware/xone.nix new file mode 100644 index 000000000000..89690d8c6fb1 --- /dev/null +++ b/nixos/modules/hardware/xone.nix @@ -0,0 +1,23 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.hardware.xone; +in +{ + options.hardware.xone = { + enable = mkEnableOption "the xone driver for Xbox One and Xbobx Series X|S accessories"; + }; + + config = mkIf cfg.enable { + boot = { + blacklistedKernelModules = [ "xpad" "mt76x2u" ]; + extraModulePackages = with config.boot.kernelPackages; [ xone ]; + }; + hardware.firmware = [ pkgs.xow_dongle-firmware ]; + }; + + meta = { + maintainers = with maintainers; [ rhysmdnz ]; + }; +} diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index c6f4ec5f08c3..fd6bd087fb7d 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -91,6 +91,7 @@ ./hardware/video/switcheroo-control.nix ./hardware/video/uvcvideo/default.nix ./hardware/video/webcam/facetimehd.nix + ./hardware/xone.nix ./hardware/xpadneo.nix ./i18n/input-method/default.nix ./i18n/input-method/fcitx.nix diff --git a/pkgs/os-specific/linux/firmware/xow_dongle-firmware/default.nix b/pkgs/os-specific/linux/firmware/xow_dongle-firmware/default.nix new file mode 100644 index 000000000000..0375eb0eead8 --- /dev/null +++ b/pkgs/os-specific/linux/firmware/xow_dongle-firmware/default.nix @@ -0,0 +1,32 @@ +{ stdenv, lib, fetchurl, cabextract }: + +stdenv.mkDerivation rec { + pname = "xow_dongle-firmware"; + version = "2017-07"; + + dontUnpack = true; + dontInstall = true; + + src = fetchurl { + url = "http://download.windowsupdate.com/c/msdownload/update/driver/drvs/2017/07/1cd6a87c-623f-4407-a52d-c31be49e925c_e19f60808bdcbfbd3c3df6be3e71ffc52e43261e.cab"; + sha256 = "013g1zngxffavqrk5jy934q3bdhsv6z05ilfixdn8dj0zy26lwv5"; + }; + + nativeBuildInputs = [ cabextract ]; + + buildPhase = '' + cabextract -F FW_ACC_00U.bin ${src} + mkdir -p $out/lib/firmware + cp -a FW_ACC_00U.bin $out/lib/firmware/xow_dongle.bin + ''; + + meta = with lib; { + description = "Xbox One wireless dongle firmware"; + homepage = "https://www.xbox.com/en-NZ/accessories/adapters/wireless-adapter-windows"; + license = licenses.unfree; + maintainers = with lib.maintainers; [ rhysmdnz ]; + platforms = platforms.linux; + }; +} + + diff --git a/pkgs/os-specific/linux/xone/default.nix b/pkgs/os-specific/linux/xone/default.nix new file mode 100644 index 000000000000..f04ccc569dff --- /dev/null +++ b/pkgs/os-specific/linux/xone/default.nix @@ -0,0 +1,39 @@ +{ stdenv, lib, fetchFromGitHub, kernel, fetchurl }: + +stdenv.mkDerivation rec { + name = "xone-${version}-${kernel.version}"; + version = "0.2"; + + src = fetchFromGitHub { + owner = "medusalix"; + repo = "xone"; + rev = "v${version}"; + sha256 = "sha256-m4305Xl5w4nyAVqubjwWsiyPDVtfGykjlSW2eKEytVk="; + }; + + setSourceRoot = '' + export sourceRoot=$(pwd)/source + ''; + + nativeBuildInputs = kernel.moduleBuildDependencies; + + makeFlags = [ + "-C" + "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build" + "M=$(sourceRoot)" + "VERSION=${version}" + ]; + + buildFlags = [ "modules" ]; + installFlags = [ "INSTALL_MOD_PATH=${placeholder "out"}" ]; + installTargets = [ "modules_install" ]; + + meta = with lib; { + description = "Linux kernel driver for Xbox One and Xbox Series X|S accessories"; + homepage = "https://github.com/medusalix/xone"; + license = licenses.gpl2; + maintainers = with lib.maintainers; [ rhysmdnz ]; + platforms = platforms.linux; + }; +} + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8dd1c813077d..7dcc882f8236 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -34197,6 +34197,8 @@ with pkgs; xosview2 = callPackage ../tools/X11/xosview2 { }; + xow_dongle-firmware = callPackage ../os-specific/linux/firmware/xow_dongle-firmware { }; + xpad = callPackage ../applications/misc/xpad { }; xsane = callPackage ../applications/graphics/sane/xsane.nix { diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index 8490870e5894..5f043faecfd7 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -462,6 +462,8 @@ in { xmm7360-pci = callPackage ../os-specific/linux/xmm7360-pci { }; + xone = if lib.versionAtLeast kernel.version "5.4" then callPackage ../os-specific/linux/xone { } else null; + xpadneo = callPackage ../os-specific/linux/xpadneo { }; zenpower = callPackage ../os-specific/linux/zenpower { };