about summary refs log tree commit diff
path: root/nixos/modules/hardware
diff options
context:
space:
mode:
authorKranium Gikos Mendoza <kranium@gikos.net>2015-12-30 02:02:36 +0800
committerKranium Gikos Mendoza <kranium@gikos.net>2016-01-28 02:59:36 +0800
commit9213916ca7a888f32d06c9220df66e789ecef8b3 (patch)
tree918dac7063196f06238ef6a64543a742692891ee /nixos/modules/hardware
parentfdb5563bcc668b96591fa2649853c4dba771aa24 (diff)
downloadnixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.tar
nixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.tar.gz
nixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.tar.bz2
nixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.tar.lz
nixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.tar.xz
nixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.tar.zst
nixlib-9213916ca7a888f32d06c9220df66e789ecef8b3.zip
facetimehd: init at git-20160127
Diffstat (limited to 'nixos/modules/hardware')
-rw-r--r--nixos/modules/hardware/video/webcam/facetimehd.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixos/modules/hardware/video/webcam/facetimehd.nix b/nixos/modules/hardware/video/webcam/facetimehd.nix
new file mode 100644
index 000000000000..83d954a0c03e
--- /dev/null
+++ b/nixos/modules/hardware/video/webcam/facetimehd.nix
@@ -0,0 +1,43 @@
+{ 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" ];
+
+    boot.extraModulePackages = [ kernelPackages.facetimehd ];
+
+    hardware.firmware = [ pkgs.facetimehd-firmware ];
+
+    # unload module during suspend/hibernate as it crashes the whole system
+    powerManagement.powerDownCommands = ''
+      ${pkgs.module_init_tools}/bin/rmmod -f facetimehd
+    '';
+
+    # and load it back on resume
+    powerManagement.resumeCommands = ''
+      export MODULE_DIR=/run/current-system/kernel-modules/lib/modules
+      ${pkgs.module_init_tools}/bin/modprobe -v facetimehd
+    '';
+
+  };
+
+}