diff options
Diffstat (limited to 'nixpkgs/nixos/modules/hardware/video')
11 files changed, 695 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix b/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix new file mode 100644 index 000000000000..ab9e0c92020e --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix @@ -0,0 +1,67 @@ +# This module provides the proprietary AMDGPU-PRO drivers. + +{ config, lib, pkgs, ... }: + +with lib; + +let + + drivers = config.services.xserver.videoDrivers; + + enabled = elem "amdgpu-pro" drivers; + + package = config.boot.kernelPackages.amdgpu-pro; + package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { libsOnly = true; kernel = null; }; + + opengl = config.hardware.opengl; + + kernel = pkgs.linux_4_9.override { + extraConfig = '' + KALLSYMS_ALL y + ''; + }; + +in + +{ + + config = mkIf enabled { + + nixpkgs.config.xorg.abiCompat = "1.19"; + + services.xserver.drivers = singleton + { name = "amdgpu"; modules = [ package ]; libPath = [ package ]; }; + + hardware.opengl.package = package; + hardware.opengl.package32 = package32; + + boot.extraModulePackages = [ package ]; + + boot.kernelPackages = + pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor kernel); + + boot.blacklistedKernelModules = [ "radeon" ]; + + hardware.firmware = [ package ]; + + system.activationScripts.setup-amdgpu-pro = '' + mkdir -p /run/lib + ln -sfn ${package}/lib ${package.libCompatDir} + ln -sfn ${package} /run/amdgpu-pro + '' + optionalString opengl.driSupport32Bit '' + ln -sfn ${package32}/lib ${package32.libCompatDir} + ''; + + system.requiredKernelConfig = with config.lib.kernelConfig; [ + (isYes "KALLSYMS_ALL") + ]; + + environment.etc = { + "amd/amdrc".source = package + "/etc/amd/amdrc"; + "amd/amdapfxx.blb".source = package + "/etc/amd/amdapfxx.blb"; + "gbm/gbm.conf".source = package + "/etc/gbm/gbm.conf"; + }; + + }; + +} diff --git a/nixpkgs/nixos/modules/hardware/video/amdgpu.nix b/nixpkgs/nixos/modules/hardware/video/amdgpu.nix new file mode 100644 index 000000000000..42fc8fa362de --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/amdgpu.nix @@ -0,0 +1,9 @@ +{ config, lib, ... }: + +with lib; +{ + config = mkIf (elem "amdgpu" config.services.xserver.videoDrivers) { + boot.blacklistedKernelModules = [ "radeon" ]; + }; +} + diff --git a/nixpkgs/nixos/modules/hardware/video/ati.nix b/nixpkgs/nixos/modules/hardware/video/ati.nix new file mode 100644 index 000000000000..6102919f0155 --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/ati.nix @@ -0,0 +1,39 @@ +# This module provides the proprietary ATI X11 / OpenGL drivers. + +{ config, lib, pkgs, ... }: + +with lib; + +let + + drivers = config.services.xserver.videoDrivers; + + enabled = elem "ati_unfree" drivers; + + ati_x11 = config.boot.kernelPackages.ati_drivers_x11; + +in + +{ + + config = mkIf enabled { + + nixpkgs.config.xorg.abiCompat = "1.17"; + + services.xserver.drivers = singleton + { name = "fglrx"; modules = [ ati_x11 ]; libPath = [ "${ati_x11}/lib" ]; }; + + hardware.opengl.package = ati_x11; + hardware.opengl.package32 = pkgs.pkgsi686Linux.linuxPackages.ati_drivers_x11.override { libsOnly = true; kernel = null; }; + + environment.systemPackages = [ ati_x11 ]; + + boot.extraModulePackages = [ ati_x11 ]; + + boot.blacklistedKernelModules = [ "radeon" ]; + + environment.etc."ati".source = "${ati_x11}/etc/ati"; + + }; + +} diff --git a/nixpkgs/nixos/modules/hardware/video/bumblebee.nix b/nixpkgs/nixos/modules/hardware/video/bumblebee.nix new file mode 100644 index 000000000000..2278c7b40611 --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/bumblebee.nix @@ -0,0 +1,93 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.hardware.bumblebee; + + kernel = config.boot.kernelPackages; + + useNvidia = cfg.driver == "nvidia"; + + bumblebee = pkgs.bumblebee.override { + inherit useNvidia; + useDisplayDevice = cfg.connectDisplay; + }; + + useBbswitch = cfg.pmMethod == "bbswitch" || cfg.pmMethod == "auto" && useNvidia; + + primus = pkgs.primus.override { + inherit useNvidia; + }; + +in + +{ + + options = { + hardware.bumblebee = { + + enable = mkOption { + default = false; + type = types.bool; + description = '' + Enable the bumblebee daemon to manage Optimus hybrid video cards. + This should power off secondary GPU until its use is requested + by running an application with optirun. + ''; + }; + + group = mkOption { + default = "wheel"; + example = "video"; + type = types.str; + description = ''Group for bumblebee socket''; + }; + + connectDisplay = mkOption { + default = false; + type = types.bool; + description = '' + Set to true if you intend to connect your discrete card to a + monitor. This option will set up your Nvidia card for EDID + discovery and to turn on the monitor signal. + + Only nvidia driver is supported so far. + ''; + }; + + driver = mkOption { + default = "nvidia"; + type = types.enum [ "nvidia" "nouveau" ]; + description = '' + Set driver used by bumblebeed. Supported are nouveau and nvidia. + ''; + }; + + pmMethod = mkOption { + default = "auto"; + type = types.enum [ "auto" "bbswitch" "switcheroo" "none" ]; + description = '' + Set preferred power management method for unused card. + ''; + }; + + }; + }; + + config = mkIf cfg.enable { + boot.blacklistedKernelModules = [ "nvidia-drm" "nvidia" "nouveau" ]; + boot.kernelModules = optional useBbswitch "bbswitch"; + boot.extraModulePackages = optional useBbswitch kernel.bbswitch ++ optional useNvidia kernel.nvidia_x11.bin; + + environment.systemPackages = [ bumblebee primus ]; + + systemd.services.bumblebeed = { + description = "Bumblebee Hybrid Graphics Switcher"; + wantedBy = [ "multi-user.target" ]; + before = [ "display-manager.service" ]; + serviceConfig = { + ExecStart = "${bumblebee}/bin/bumblebeed --use-syslog -g ${cfg.group} --driver ${cfg.driver} --pm-method ${cfg.pmMethod}"; + }; + }; + }; +} diff --git a/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix b/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix new file mode 100644 index 000000000000..61bab533edaf --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/capture/mwprocapture.nix @@ -0,0 +1,61 @@ +{ config, lib, ... }: + +with lib; + +let + + cfg = config.hardware.mwProCapture; + + kernelPackages = config.boot.kernelPackages; + +in + +{ + + options.hardware.mwProCapture.enable = mkEnableOption "Magewell Pro Capture family kernel module"; + + config = mkIf cfg.enable { + + assertions = singleton { + assertion = versionAtLeast kernelPackages.kernel.version "3.2"; + message = "Magewell Pro Capture family module is not supported for kernels older than 3.2"; + }; + + boot.kernelModules = [ "ProCapture" ]; + + environment.systemPackages = [ kernelPackages.mwprocapture ]; + + boot.extraModulePackages = [ kernelPackages.mwprocapture ]; + + boot.extraModprobeConfig = '' + # Set the png picture to be displayed when no input signal is detected. + options ProCapture nosignal_file=${kernelPackages.mwprocapture}/res/NoSignal.png + + # Set the png picture to be displayed when an unsupported input signal is detected. + options ProCapture unsupported_file=${kernelPackages.mwprocapture}/res/Unsupported.png + + # Set the png picture to be displayed when an loking input signal is detected. + options ProCapture locking_file=${kernelPackages.mwprocapture}/res/Locking.png + + # Message signaled interrupts switch + #options ProCapture disable_msi=0 + + # Set the debug level + #options ProCapture debug_level=0 + + # Force init switch eeprom + #options ProCapture init_switch_eeprom=0 + + # Min frame interval for VIDIOC_ENUM_FRAMEINTERVALS (default: 166666(100ns)) + #options ProCapture enum_frameinterval_min=166666 + + # VIDIOC_ENUM_FRAMESIZES type (1: DISCRETE; 2: STEPWISE; otherwise: CONTINUOUS ) + #options ProCapture enum_framesizes_type=0 + + # Parameters for internal usage + #options ProCapture internal_params="" + ''; + + }; + +} diff --git a/nixpkgs/nixos/modules/hardware/video/displaylink.nix b/nixpkgs/nixos/modules/hardware/video/displaylink.nix new file mode 100644 index 000000000000..669ac849cbad --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/displaylink.nix @@ -0,0 +1,66 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + enabled = elem "displaylink" config.services.xserver.videoDrivers; + + evdi = config.boot.kernelPackages.evdi; + + displaylink = pkgs.displaylink.override { + inherit evdi; + }; + +in + +{ + + config = mkIf enabled { + + boot.extraModulePackages = [ evdi ]; + + # Those are taken from displaylink-installer.sh and from Arch Linux AUR package. + + services.udev.packages = [ displaylink ]; + + powerManagement.powerDownCommands = '' + #flush any bytes in pipe + while read -n 1 -t 1 SUSPEND_RESULT < /tmp/PmMessagesPort_out; do : ; done; + + #suspend DisplayLinkManager + echo "S" > /tmp/PmMessagesPort_in + + #wait until suspend of DisplayLinkManager finish + if [ -f /tmp/PmMessagesPort_out ]; then + #wait until suspend of DisplayLinkManager finish + read -n 1 -t 10 SUSPEND_RESULT < /tmp/PmMessagesPort_out + fi + ''; + + powerManagement.resumeCommands = '' + #resume DisplayLinkManager + echo "R" > /tmp/PmMessagesPort_in + ''; + + systemd.services.dlm = { + description = "DisplayLink Manager Service"; + after = [ "display-manager.service" ]; + conflicts = [ "getty@tty7.service" ]; + path = [ pkgs.kmod ]; + + serviceConfig = { + ExecStart = "${displaylink}/bin/DisplayLinkManager"; + Restart = "always"; + RestartSec = 5; + }; + + preStart = '' + mkdir -p /var/log/displaylink + modprobe evdi + ''; + }; + + }; + +} diff --git a/nixpkgs/nixos/modules/hardware/video/nvidia.nix b/nixpkgs/nixos/modules/hardware/video/nvidia.nix new file mode 100644 index 000000000000..80ea7bc5d5c9 --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/nvidia.nix @@ -0,0 +1,204 @@ +# This module provides the proprietary NVIDIA X11 / OpenGL drivers. + +{ stdenv, config, lib, pkgs, ... }: + +with lib; + +let + + drivers = config.services.xserver.videoDrivers; + + # FIXME: should introduce an option like + # ‘hardware.video.nvidia.package’ for overriding the default NVIDIA + # driver. + nvidiaForKernel = kernelPackages: + if elem "nvidia" drivers then + kernelPackages.nvidia_x11 + else if elem "nvidiaBeta" drivers then + kernelPackages.nvidia_x11_beta + else if elem "nvidiaLegacy304" drivers then + kernelPackages.nvidia_x11_legacy304 + else if elem "nvidiaLegacy340" drivers then + kernelPackages.nvidia_x11_legacy340 + else if elem "nvidiaLegacy390" drivers then + kernelPackages.nvidia_x11_legacy390 + else null; + + nvidia_x11 = nvidiaForKernel config.boot.kernelPackages; + nvidia_libs32 = + if versionOlder nvidia_x11.version "391" then + ((nvidiaForKernel pkgs.pkgsi686Linux.linuxPackages).override { libsOnly = true; kernel = null; }).out + else + (nvidiaForKernel config.boot.kernelPackages).lib32; + + enabled = nvidia_x11 != null; + + cfg = config.hardware.nvidia; + optimusCfg = cfg.optimus_prime; +in + +{ + options = { + hardware.nvidia.modesetting.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable kernel modesetting when using the NVIDIA proprietary driver. + + Enabling this fixes screen tearing when using Optimus via PRIME (see + <option>hardware.nvidia.optimus_prime.enable</option>. This is not enabled + by default because it is not officially supported by NVIDIA and would not + work with SLI. + ''; + }; + + hardware.nvidia.optimus_prime.enable = lib.mkOption { + type = lib.types.bool; + default = false; + description = '' + Enable NVIDIA Optimus support using the NVIDIA proprietary driver via PRIME. + If enabled, the NVIDIA GPU will be always on and used for all rendering, + while enabling output to displays attached only to the integrated Intel GPU + without a multiplexer. + + Note that this option only has any effect if the "nvidia" driver is specified + in <option>services.xserver.videoDrivers</option>, and it should preferably + be the only driver there. + + If this is enabled, then the bus IDs of the NVIDIA and Intel GPUs have to be + specified (<option>hardware.nvidia.optimus_prime.nvidiaBusId</option> and + <option>hardware.nvidia.optimus_prime.intelBusId</option>). + + If you enable this, you may want to also enable kernel modesetting for the + NVIDIA driver (<option>hardware.nvidia.modesetting.enable</option>) in order + to prevent tearing. + + Note that this configuration will only be successful when a display manager + for which the <option>services.xserver.displayManager.setupCommands</option> + option is supported is used; notably, SLiM is not supported. + ''; + }; + + hardware.nvidia.optimus_prime.nvidiaBusId = lib.mkOption { + type = lib.types.string; + default = ""; + example = "PCI:1:0:0"; + description = '' + Bus ID of the NVIDIA GPU. You can find it using lspci; for example if lspci + shows the NVIDIA GPU at "01:00.0", set this option to "PCI:1:0:0". + ''; + }; + + hardware.nvidia.optimus_prime.intelBusId = lib.mkOption { + type = lib.types.string; + default = ""; + example = "PCI:0:2:0"; + description = '' + Bus ID of the Intel GPU. You can find it using lspci; for example if lspci + shows the Intel GPU at "00:02.0", set this option to "PCI:0:2:0". + ''; + }; + }; + + config = mkIf enabled { + assertions = [ + { + assertion = with config.services.xserver.displayManager; gdm.enable -> !gdm.wayland; + message = "NVIDIA drivers don't support wayland, set services.xserver.displayManager.gdm.wayland=false"; + } + { + assertion = !optimusCfg.enable || + (optimusCfg.nvidiaBusId != "" && optimusCfg.intelBusId != ""); + message = '' + When NVIDIA Optimus via PRIME is enabled, the GPU bus IDs must configured. + ''; + } + ]; + + # If Optimus/PRIME is enabled, we: + # - Specify the configured NVIDIA GPU bus ID in the Device section for the + # "nvidia" driver. + # - Add the AllowEmptyInitialConfiguration option to the Screen section for the + # "nvidia" driver, in order to allow the X server to start without any outputs. + # - Add a separate Device section for the Intel GPU, using the "modesetting" + # driver and with the configured BusID. + # - Reference that Device section from the ServerLayout section as an inactive + # device. + # - Configure the display manager to run specific `xrandr` commands which will + # configure/enable displays connected to the Intel GPU. + + services.xserver.drivers = singleton { + name = "nvidia"; + modules = [ nvidia_x11.bin ]; + libPath = [ nvidia_x11 ]; + deviceSection = optionalString optimusCfg.enable + '' + BusID "${optimusCfg.nvidiaBusId}" + ''; + screenSection = + '' + Option "RandRRotation" "on" + ${optionalString optimusCfg.enable "Option \"AllowEmptyInitialConfiguration\""} + ''; + }; + + services.xserver.extraConfig = optionalString optimusCfg.enable + '' + Section "Device" + Identifier "nvidia-optimus-intel" + Driver "modesetting" + BusID "${optimusCfg.intelBusId}" + Option "AccelMethod" "none" + EndSection + ''; + services.xserver.serverLayoutSection = optionalString optimusCfg.enable + '' + Inactive "nvidia-optimus-intel" + ''; + + services.xserver.displayManager.setupCommands = optionalString optimusCfg.enable '' + # Added by nvidia configuration module for Optimus/PRIME. + ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0 + ${pkgs.xorg.xrandr}/bin/xrandr --auto + ''; + + environment.etc."nvidia/nvidia-application-profiles-rc" = mkIf nvidia_x11.useProfiles { + source = "${nvidia_x11.bin}/share/nvidia/nvidia-application-profiles-rc"; + }; + + hardware.opengl.package = nvidia_x11.out; + hardware.opengl.package32 = nvidia_libs32; + + environment.systemPackages = [ nvidia_x11.bin nvidia_x11.settings ] + ++ lib.filter (p: p != null) [ nvidia_x11.persistenced ]; + + systemd.tmpfiles.rules = optional config.virtualisation.docker.enableNvidia + "L+ /run/nvidia-docker/bin - - - - ${nvidia_x11.bin}/origBin" + ++ optional (nvidia_x11.persistenced != null && config.virtualisation.docker.enableNvidia) + "L+ /run/nvidia-docker/extras/bin/nvidia-persistenced - - - - ${nvidia_x11.persistenced}/origBin/nvidia-persistenced"; + + boot.extraModulePackages = [ nvidia_x11.bin ]; + + # nvidia-uvm is required by CUDA applications. + boot.kernelModules = [ "nvidia-uvm" ] ++ + lib.optionals config.services.xserver.enable [ "nvidia" "nvidia_modeset" "nvidia_drm" ]; + + # If requested enable modesetting via kernel parameter. + boot.kernelParams = optional cfg.modesetting.enable "nvidia-drm.modeset=1"; + + # Create /dev/nvidia-uvm when the nvidia-uvm module is loaded. + services.udev.extraRules = + '' + KERNEL=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidiactl c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'" + KERNEL=="nvidia_modeset", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-modeset c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'" + KERNEL=="card*", SUBSYSTEM=="drm", DRIVERS=="nvidia", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia%n c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) %n'" + KERNEL=="nvidia_uvm", RUN+="${pkgs.runtimeShell} -c 'mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'" + ''; + + boot.blacklistedKernelModules = [ "nouveau" "nvidiafb" ]; + + services.acpid.enable = true; + + }; + +} diff --git a/nixpkgs/nixos/modules/hardware/video/radeon.nix b/nixpkgs/nixos/modules/hardware/video/radeon.nix new file mode 100644 index 000000000000..c92b7a0509d0 --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/radeon.nix @@ -0,0 +1,3 @@ +{ + hardware.enableRedistributableFirmware = true; +} diff --git a/nixpkgs/nixos/modules/hardware/video/uvcvideo/default.nix b/nixpkgs/nixos/modules/hardware/video/uvcvideo/default.nix new file mode 100644 index 000000000000..7e3e94fdf2bd --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/uvcvideo/default.nix @@ -0,0 +1,64 @@ + +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.services.uvcvideo; + + uvcdynctrl-udev-rules = packages: pkgs.callPackage ./uvcdynctrl-udev-rules.nix { + drivers = packages; + udevDebug = false; + }; + +in + +{ + + options = { + services.uvcvideo.dynctrl = { + + enable = mkOption { + type = types.bool; + default = false; + description = '' + Whether to enable <command>uvcvideo</command> dynamic controls. + + Note that enabling this brings the <command>uvcdynctrl</command> tool + into your environement and register all dynamic controls from + specified <command>packages</command> to the <command>uvcvideo</command> driver. + ''; + }; + + packages = mkOption { + type = types.listOf types.path; + example = literalExample "[ pkgs.tiscamera ]"; + description = '' + List of packages containing <command>uvcvideo</command> dynamic controls + rules. All files found in + <filename><replaceable>pkg</replaceable>/share/uvcdynctrl/data</filename> + will be included. + + Note that these will serve as input to the <command>libwebcam</command> + package which through its own <command>udev</command> rule will register + the dynamic controls from specified packages to the <command>uvcvideo</command> + driver. + ''; + apply = map getBin; + }; + }; + }; + + config = mkIf cfg.dynctrl.enable { + + services.udev.packages = [ + (uvcdynctrl-udev-rules cfg.dynctrl.packages) + ]; + + environment.systemPackages = [ + pkgs.libwebcam + ]; + + }; +} diff --git a/nixpkgs/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix b/nixpkgs/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix new file mode 100644 index 000000000000..a808429c9996 --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/uvcvideo/uvcdynctrl-udev-rules.nix @@ -0,0 +1,45 @@ +{ buildEnv +, libwebcam +, makeWrapper +, runCommand +, drivers ? [] +, udevDebug ? false +}: + +let + version = "0.0.0"; + + dataPath = buildEnv { + name = "uvcdynctrl-with-drivers-data-path"; + paths = drivers ++ [ libwebcam ]; + pathsToLink = [ "/share/uvcdynctrl/data" ]; + ignoreCollisions = false; + }; + + dataDir = "${dataPath}/share/uvcdynctrl/data"; + udevDebugVarValue = if udevDebug then "1" else "0"; +in + +runCommand "uvcdynctrl-udev-rules-${version}" +{ + inherit dataPath; + buildInputs = [ + makeWrapper + libwebcam + ]; + dontPatchELF = true; + dontStrip = true; + preferLocalBuild = true; +} +'' + mkdir -p "$out/lib/udev" + makeWrapper "${libwebcam}/lib/udev/uvcdynctrl" "$out/lib/udev/uvcdynctrl" \ + --set NIX_UVCDYNCTRL_DATA_DIR "${dataDir}" \ + --set NIX_UVCDYNCTRL_UDEV_DEBUG "${udevDebugVarValue}" + + mkdir -p "$out/lib/udev/rules.d" + cat "${libwebcam}/lib/udev/rules.d/80-uvcdynctrl.rules" | \ + sed -r "s#RUN\+\=\"([^\"]+)\"#RUN\+\=\"$out/lib/udev/uvcdynctrl\"#g" > \ + "$out/lib/udev/rules.d/80-uvcdynctrl.rules" +'' + diff --git a/nixpkgs/nixos/modules/hardware/video/webcam/facetimehd.nix b/nixpkgs/nixos/modules/hardware/video/webcam/facetimehd.nix new file mode 100644 index 000000000000..d311f600c319 --- /dev/null +++ b/nixpkgs/nixos/modules/hardware/video/webcam/facetimehd.nix @@ -0,0 +1,44 @@ +{ 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.blacklistedKernelModules = [ "bdc_pci" ]; + + boot.extraModulePackages = [ kernelPackages.facetimehd ]; + + hardware.firmware = [ pkgs.facetimehd-firmware ]; + + # 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 + ''; + + }; + +} |