mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 22:10:14 +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
# Run: $(nix-build nixos/modules/hardware/facter/fingerprint/update.nix)/bin/update-fprint-devices
|
|
{
|
|
pkgs ? import ../../../../.. { },
|
|
}:
|
|
let
|
|
fprint-supported-devices = pkgs.libfprint.overrideAttrs (old: {
|
|
nativeBuildInputs = old.nativeBuildInputs or [ ] ++ [
|
|
pkgs.jq
|
|
pkgs.gawk
|
|
];
|
|
buildPhase = ''
|
|
ninja libfprint/fprint-list-supported-devices
|
|
'';
|
|
outputs = [ "out" ];
|
|
installPhase = ''
|
|
./libfprint/fprint-list-supported-devices | \
|
|
grep -o -E '(\b[0-9a-fA-F]{4}:[0-9a-fA-F]{4}\b)' | \
|
|
awk '{print toupper($0)}' | \
|
|
jq -S -R -s 'split("\n") | map(select(. != "")) | map({key: ., value: true}) | from_entries' > $out
|
|
'';
|
|
# we cannot disable doInstallcheck because than we are missing nativeCheckInputs dependencies
|
|
installCheckPhase = "";
|
|
});
|
|
in
|
|
pkgs.writeShellApplication {
|
|
name = "update-fprint-devices";
|
|
runtimeInputs = with pkgs; [
|
|
coreutils
|
|
git
|
|
];
|
|
text = ''
|
|
root="$(git rev-parse --show-toplevel)"
|
|
target="$root/nixos/modules/hardware/facter/fingerprint/devices.json"
|
|
cp ${fprint-supported-devices} "$target"
|
|
echo "Updated $target"
|
|
'';
|
|
}
|