Merge pull request #139502 from Vodurden/nixos-unstable

Support virtual Nintendo Switch Pro controllers in joycond
This commit is contained in:
Timo Kaufmann 2021-10-07 13:54:30 +02:00 committed by GitHub
commit 043bc8a984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 58 additions and 4 deletions

View File

@ -321,6 +321,14 @@
<link linkend="opt-programs.pantheon-tweaks.enable">programs.pantheon-tweaks</link>.
</para>
</listitem>
<listitem>
<para>
<link xlink:href="https://github.com/DanielOgorchock/joycond">joycond</link>,
a service that uses <literal>hid-nintendo</literal> to provide
nintendo joycond pairing and better nintendo switch pro
controller support.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-21.11-incompatibilities">

View File

@ -99,6 +99,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- [pantheon-tweaks](https://github.com/pantheon-tweaks/pantheon-tweaks), an unofficial system settings panel for Pantheon. Available as [programs.pantheon-tweaks](#opt-programs.pantheon-tweaks.enable).
- [joycond](https://github.com/DanielOgorchock/joycond), a service that uses `hid-nintendo` to provide nintendo joycond pairing and better nintendo switch pro controller support.
## Backward Incompatibilities {#sec-release-21.11-incompatibilities}
- The `security.wrappers` option now requires to always specify an owner, group and whether the setuid/setgid bit should be set.

View File

@ -412,6 +412,7 @@
./services/hardware/illum.nix
./services/hardware/interception-tools.nix
./services/hardware/irqbalance.nix
./services/hardware/joycond.nix
./services/hardware/lcd.nix
./services/hardware/lirc.nix
./services/hardware/nvidia-optimus.nix

View File

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
let
cfg = config.services.joycond;
kernelPackages = config.boot.kernelPackages;
in
with lib;
{
options.services.joycond = {
enable = mkEnableOption "support for Nintendo Pro Controllers and Joycons";
package = mkOption {
type = types.package;
default = pkgs.joycond;
defaultText = "pkgs.joycond";
description = ''
The joycond package to use.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [
kernelPackages.hid-nintendo
cfg.package
];
boot.extraModulePackages = [ kernelPackages.hid-nintendo ];
boot.kernelModules = [ "hid_nintendo" ];
services.udev.packages = [ cfg.package ];
systemd.packages = [ cfg.package ];
# Workaround for https://github.com/NixOS/nixpkgs/issues/81138
systemd.services.joycond.wantedBy = [ "multi-user.target" ];
};
}

View File

@ -1,14 +1,14 @@
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libevdev, udev }:
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config, libevdev, udev, acl }:
stdenv.mkDerivation rec {
pname = "joycond";
version = "unstable-2021-03-27";
version = "unstable-2021-07-30";
src = fetchFromGitHub {
owner = "DanielOgorchock";
repo = "joycond";
rev = "2d3f553060291f1bfee2e49fc2ca4a768b289df8";
sha256 = "0dpmwspll9ar3pxg9rgnh224934par8h8bixdz9i2pqqbc3dqib7";
rev = "f9a66914622514c13997c2bf7ec20fa98e9dfc1d";
sha256 = "sha256-quw7yBHDDZk1+6uHthsfMCej7g5uP0nIAqzvI6436B8=";
};
nativeBuildInputs = [ cmake pkg-config ];
@ -25,6 +25,9 @@ stdenv.mkDerivation rec {
substituteInPlace $out/etc/systemd/system/joycond.service --replace \
"ExecStart=/usr/bin/joycond" "ExecStart=$out/bin/joycond"
substituteInPlace $out/etc/udev/rules.d/89-joycond.rules --replace \
"/bin/setfacl" "${acl}/bin/setfacl"
'';
meta = with lib; {