2015-12-29 18:02:36 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.hardware.facetimehd;
|
|
|
|
|
|
|
|
kernelPackages = config.boot.kernelPackages;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options.hardware.facetimehd.enable = mkEnableOption "facetimehd kernel module";
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
assertions = singleton {
|
|
|
|
assertion = versionAtLeast kernelPackages.kernel.version "3.19";
|
|
|
|
message = "facetimehd is not supported for kernels older than 3.19";
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.kernelModules = [ "facetimehd" ];
|
|
|
|
|
2016-02-04 03:31:28 +00:00
|
|
|
boot.blacklistedKernelModules = [ "bdc_pci" ];
|
|
|
|
|
2015-12-29 18:02:36 +00:00
|
|
|
boot.extraModulePackages = [ kernelPackages.facetimehd ];
|
|
|
|
|
|
|
|
hardware.firmware = [ pkgs.facetimehd-firmware ];
|
|
|
|
|
|
|
|
# unload module during suspend/hibernate as it crashes the whole system
|
|
|
|
powerManagement.powerDownCommands = ''
|
2016-04-22 03:35:41 +01:00
|
|
|
${pkgs.kmod}/bin/lsmod | ${pkgs.gnugrep}/bin/grep -q "^facetimehd" && ${pkgs.kmod}/bin/rmmod -f -v facetimehd
|
2015-12-29 18:02:36 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
# and load it back on resume
|
|
|
|
powerManagement.resumeCommands = ''
|
2016-04-22 08:40:57 +01:00
|
|
|
${pkgs.kmod}/bin/modprobe -v facetimehd
|
2015-12-29 18:02:36 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|