1 { config, lib, pkgs, ... }:
7 cfg = config.hardware.facetimehd;
9 kernelPackages = config.boot.kernelPackages;
15 options.hardware.facetimehd.enable = mkEnableOption (lib.mdDoc "the facetimehd kernel module");
17 options.hardware.facetimehd.withCalibration = mkOption {
21 description = lib.mdDoc ''
22 Whether to include sensor calibration files for facetimehd.
23 This makes colors look much better but is experimental, see
24 <https://github.com/patjak/facetimehd/wiki/Extracting-the-sensor-calibration-files>
29 config = mkIf cfg.enable {
31 boot.kernelModules = [ "facetimehd" ];
33 boot.blacklistedKernelModules = [ "bdc_pci" ];
35 boot.extraModulePackages = [ kernelPackages.facetimehd ];
37 hardware.firmware = [ pkgs.facetimehd-firmware ]
38 ++ optional cfg.withCalibration pkgs.facetimehd-calibration;
40 # unload module during suspend/hibernate as it crashes the whole system
41 powerManagement.powerDownCommands = ''
42 ${pkgs.kmod}/bin/lsmod | ${pkgs.gnugrep}/bin/grep -q "^facetimehd" && ${pkgs.kmod}/bin/rmmod -f -v facetimehd
45 # and load it back on resume
46 powerManagement.resumeCommands = ''
47 ${pkgs.kmod}/bin/modprobe -v facetimehd