Skip to content

Instantly share code, notes, and snippets.

@aaronjanse
Created December 25, 2020 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaronjanse/107db3b8f48853ff5fc4c5b4cce66843 to your computer and use it in GitHub Desktop.
Save aaronjanse/107db3b8f48853ff5fc4c5b4cce66843 to your computer and use it in GitHub Desktop.
{ stdenv, pkgconfig, fetchurl, xwiimote, udev, xorg }:
stdenv.mkDerivation rec {
name = "xf86-input-xwiimote";
src = fetchurl {
url = "https://github.com/dvdhrm/xf86-input-xwiimote/releases/download/${name}-0.5/${name}-0.5.tar.xz";
sha256 = "1gwnbnhybrmhmrp4i2b5yr624mvrr9bpk0r2592y8rm7c5lzqfba";
};
nativeBuildInputs = [ pkgconfig ];
buildInputs = with xorg; [ xwiimote udev xorgserver ];
# preConfigure = ''
# mkdir -p $out/share/X11/xorg.conf.d
# configureFlags="--with-xorg-module-dir=$out/lib/xorg/modules
# --with-sdkdir=$out/include/xorg --with-xorg-conf-dir=$out/share/X11/xorg.conf.d"
# '';
patchPhase = ''
sed -i 's#motion = "";#motion = "motionplus";#g' src/xwiimote.c
'';
meta = {
homepage = http://dvdhrm.github.io/xwiimote;
description = "X.Org Wii Remote Input Driver";
platforms = stdenv.lib.platforms.linux;
};
postInstallPhase = ''
# mkdir -p "$out/share/X11/xorg.conf.d/"
# cp "60-xorg-xwiimote.conf" "$out/share/X11/xorg.conf.d/60-xorg-xwiimote.conf"
cat > $out/share/X11/xorg.conf.d/60-xorg-xwiimote.conf << EOF
Section "InputClass"
Identifier "Nintendo Wii Remote"
MatchProduct "Nintendo Wii Remote"
MatchDevicePath "/dev/input/event*"
Option "Ignore" "off"
Driver "xwiimote"
EndSection
Section "InputClass"
Identifier "Nintendo Wii Remote Classic Controller Whitelist"
MatchProduct "Nintendo Wii Remote Classic Controller"
MatchDevicePath "/dev/input/event*"
Option "Ignore" "off"
Driver "evdev"
EndSection
Section "InputClass"
Identifier "Nintendo Wii Remote Pro Controller Whitelist"
MatchProduct "Nintendo Wii Remote Pro Controller"
MatchDevicePath "/dev/input/event*"
Option "Ignore" "off"
Driver "evdev"
EndSection
EOF
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment