Subject: [PATCH] gnu: Add xone.

From: Morgan Smith <[email-masked]>
Date: Mon, 31 Mar 2025 14:56:03 -0400

* gnu/packages/linux.scm (xone): New variable.

Change-Id: I289868cfe81ed8804c7ee2a4ce5713569983bd34
---
 gnu/packages/linux.scm | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 4354d9b8b4..08cd346e6c 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -2342,6 +2342,47 @@ (define-public xpadneo
 which need to be installed separately.")
     (license license:gpl3+)))
 
+(define-public xone
+  (let ((commit "aeb27e6d98f7b22b3672701af6171612254a4d0c")
+        (revision "0"))
+    (package
+      (name "xone")
+      (version (git-version "0.3" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/dlundqvist/xone")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "111zwsy1z4g1qlp98s617ng2n5qinp9whynlvcaynvyl7giv4p0h"))))
+      (build-system linux-module-build-system)
+      (arguments
+       (list #:tests? #f                  ; no `check' target
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'install 'post-install
+                   (lambda _
+                     ;; Copied from install.sh.
+                     ;; This isn't useful though because xpad is builtin to
+                     ;; the kernel so it has to be blacklisted using a kernel
+                     ;; argument.
+                     (let ((modprobe-dir (string-append #$output "/etc/modprobe.d")))
+                       (mkdir-p modprobe-dir)
+                       (copy-file "install/modprobe.conf"
+                                  (string-append modprobe-dir
+                                                 "/xone-blacklist.conf"))))))))
+
+      (home-page "https://github.com/dlundqvist/xone")
+      (synopsis "Linux kernel driver for Xbox One and Xbox Series X|S accessories")
+      (description "A replacement for xpad.
+
+To use the xone driver add it to the @code{kernel-loadable-modules} in your
+system configuration.  Then add @code{xpad} and @code{mt76x2u} to the modprobe
+blacklist.")
+      (license license:gpl2))))
+
 (define-public vendor-reset-linux-module
   (let ((commit "4b466e92a2d9f76ce1082cde982c7be0be91e248")
         (revision "0"))

base-commit: 5735c278e16517d9be5e26235fe68dea9bae3527
-- 
2.49.0