mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-28 02:40:50 +00:00
This adds automatic detection and configuration for input peripherals: - bluetooth: Detects Bluetooth hardware and automatically enables - fingerprint: Detects USB fingerprint devices using libfprint device database Builds on PR #458177 (graphics). Part of incremental upstreaming from nixos-facter-modules.
38 lines
1.1 KiB
Nix
38 lines
1.1 KiB
Nix
# To update devices.json, run:
|
|
# $(nix-build nixos/modules/hardware/facter/fingerprint/update.nix)/bin/update-fprint-devices
|
|
{ lib, config, ... }:
|
|
let
|
|
facterLib = import ../lib.nix lib;
|
|
|
|
devices = builtins.fromJSON (builtins.readFile ./devices.json);
|
|
default = {
|
|
value = 0;
|
|
};
|
|
|
|
isSupported = lib.any (
|
|
{
|
|
vendor ? default,
|
|
device ? default,
|
|
bus_type ? {
|
|
name = "";
|
|
},
|
|
...
|
|
}:
|
|
bus_type.name == "USB"
|
|
&& devices ? "${facterLib.toZeroPaddedHex vendor.value}:${facterLib.toZeroPaddedHex device.value}"
|
|
);
|
|
in
|
|
{
|
|
options.hardware.facter.detected.fingerprint.enable = lib.mkEnableOption "Fingerprint devices" // {
|
|
default =
|
|
isSupported (config.hardware.facter.report.hardware.unknown or [ ])
|
|
|| isSupported (config.hardware.facter.report.hardware.fingerprint or [ ])
|
|
|| isSupported (config.hardware.facter.report.hardware.usb or [ ]);
|
|
defaultText = "hardware dependent";
|
|
};
|
|
|
|
config.services.fprintd.enable = lib.mkIf config.hardware.facter.detected.fingerprint.enable (
|
|
lib.mkDefault true
|
|
);
|
|
}
|