Files
nixpkgs/nixos/modules/hardware/facter/fingerprint/default.nix
Jörg Thalheim 8b9171eed7 nixos/facter: add input peripheral detection
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.
2025-12-01 13:48:46 +01:00

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
);
}