Files
nixpkgs/nixos/modules/hardware/video/webcam/facetimehd.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

57 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
cfg = config.hardware.facetimehd;
kernelPackages = config.boot.kernelPackages;
in
{
options.hardware.facetimehd.enable = lib.mkEnableOption "the facetimehd kernel module";
options.hardware.facetimehd.withCalibration = lib.mkOption {
default = false;
example = true;
type = lib.types.bool;
description = ''
Whether to include sensor calibration files for facetimehd.
This makes colors look much better but is experimental, see
<https://github.com/patjak/facetimehd/wiki/Extracting-the-sensor-calibration-files>
for details.
'';
};
config = lib.mkIf cfg.enable {
boot.kernelModules = [ "facetimehd" ];
boot.blacklistedKernelModules = [ "bdc_pci" ];
boot.extraModulePackages = [ kernelPackages.facetimehd ];
hardware.firmware = [
pkgs.facetimehd-firmware
]
++ lib.optional cfg.withCalibration pkgs.facetimehd-calibration;
# unload module during suspend/hibernate as it crashes the whole system
powerManagement.powerDownCommands = ''
${pkgs.kmod}/bin/lsmod | ${pkgs.gnugrep}/bin/grep -q "^facetimehd" && ${pkgs.kmod}/bin/rmmod -f -v facetimehd
'';
# and load it back on resume
powerManagement.resumeCommands = ''
${pkgs.kmod}/bin/modprobe -v facetimehd
'';
};
}