1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7let
8
9 cfg = config.hardware.steam-hardware;
10
11in
12
13{
14 options.hardware.steam-hardware = {
15 enable = lib.mkOption {
16 type = lib.types.bool;
17 default = false;
18 description = "Enable udev rules for Steam hardware such as the Steam Controller, other supported controllers and the HTC Vive";
19 };
20 };
21
22 config = lib.mkIf cfg.enable {
23 services.udev.packages = [
24 pkgs.steam-devices-udev-rules
25 ];
26
27 # The uinput module needs to be loaded in order to trigger the udev rules
28 # defined in the steam package for setting permissions on /dev/uinput.
29 #
30 # If the udev rules are not triggered, some controllers won't work with
31 # steam.
32 boot.kernelModules = [ "uinput" ];
33 };
34}