forked from pub-solar/os
games: add wii-u-gc-adapter package and service
This commit is contained in:
parent
adce24be8b
commit
38b2ba7dda
40
modules/services/hardware/wii-u-gc-adapter.nix
Normal file
40
modules/services/hardware/wii-u-gc-adapter.nix
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let cfg = config.services.wii-u-gc-adapter;
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
services.wii-u-gc-adapter = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to enable wii-u-gc-adapter service to automatically start
|
||||||
|
when the controller adapter is plugged in.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
# start wii-u-gc-adapter when plugged in
|
||||||
|
ACTION=="add", SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="057e", \
|
||||||
|
ENV{ID_MODEL_ID}=="0337", TAG+="systemd", \
|
||||||
|
ENV{SYSTEMD_ALIAS}="/sys/subsystem/usb/wii-u-gc-adapter", \
|
||||||
|
ENV{SYSTEMD_WANTS}+="wii-u-gc-adapter.service"
|
||||||
|
|
||||||
|
# workaround for https://github.com/systemd/systemd/issues/7587
|
||||||
|
ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="57e/337/100", \
|
||||||
|
TAG+="systemd"
|
||||||
|
'';
|
||||||
|
|
||||||
|
systemd.services.wii-u-gc-adapter = {
|
||||||
|
enable = true;
|
||||||
|
script = ''
|
||||||
|
${pkgs.wii-u-gc-adapter}/bin/wii-u-gc-adapter
|
||||||
|
'';
|
||||||
|
unitConfig = { StopWhenUnneeded = true; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,4 +5,5 @@ final: prev: {
|
||||||
purs = prev.callPackage ./shells/zsh/purs { };
|
purs = prev.callPackage ./shells/zsh/purs { };
|
||||||
pure = prev.callPackage ./shells/zsh/pure { };
|
pure = prev.callPackage ./shells/zsh/pure { };
|
||||||
dzvol = prev.callPackage ./applications/misc/dzvol.nix { };
|
dzvol = prev.callPackage ./applications/misc/dzvol.nix { };
|
||||||
|
wii-u-gc-adapter = prev.callPackage ./misc/drivers/wii-u-gc-adapter { };
|
||||||
}
|
}
|
||||||
|
|
21
pkgs/misc/drivers/wii-u-gc-adapter/default.nix
Normal file
21
pkgs/misc/drivers/wii-u-gc-adapter/default.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ stdenv, fetchFromGitHub, pkgconfig, libudev, libusb, ... }:
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "wii-u-gc-adapter";
|
||||||
|
|
||||||
|
buildInputs = [ pkgconfig libudev libusb ];
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "ToadKing";
|
||||||
|
repo = "wii-u-gc-adapter";
|
||||||
|
rev = "ae6b46d7a2b32068e746f1d2d816f4b3d6a7ac80";
|
||||||
|
hash = "sha256-Dk4jMaL5P85yxH3pDVBDNKjtGL4gRkhN5CJqZnOAshE=";
|
||||||
|
};
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
install wii-u-gc-adapter $out/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
hardeningDisable = [ "format" ];
|
||||||
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
{ unstablePkgs, ... }: {
|
{ unstablePkgs, ... }: {
|
||||||
imports = [ ../graphical ./udev.nix ];
|
imports = [
|
||||||
|
../graphical
|
||||||
|
./udev.nix
|
||||||
|
../../modules/services/hardware/wii-u-gc-adapter.nix
|
||||||
|
];
|
||||||
environment.systemPackages = with unstablePkgs; [
|
environment.systemPackages = with unstablePkgs; [
|
||||||
retroarchBare
|
retroarchBare
|
||||||
steam
|
steam
|
||||||
|
@ -8,6 +12,8 @@
|
||||||
qjoypad
|
qjoypad
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.wii-u-gc-adapter.enable = true;
|
||||||
|
|
||||||
# fps games on laptop need this
|
# fps games on laptop need this
|
||||||
services.xserver.libinput.disableWhileTyping = false;
|
services.xserver.libinput.disableWhileTyping = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue