1{ stdenv, fetchFromGitHub, kernel }:
2
3# facetimehd is not supported for kernels older than 3.19";
4assert stdenv.lib.versionAtLeast kernel.version "3.19";
5
6let
7 # Note: When updating this revision:
8 # 1. Also update pkgs/os-specific/linux/firmware/facetimehd-firmware/
9 # 2. Test the module and firmware change via:
10 # a. Give some applications a try (Skype, Hangouts, Cheese, etc.)
11 # b. Run: journalctl -f
12 # c. Then close the lid
13 # d. Then open the lid (and maybe press a key to wake it up)
14 # e. see if the module loads back (apps using the camera won't
15 # recover and will have to be restarted) and the camera
16 # still works.
17 srcParams = if (stdenv.lib.versionAtLeast kernel.version "4.8") then
18 { # Use mainline branch
19 version = "unstable-2016-10-09";
20 rev = "887d0f531ef7b91457be519474136c3355c5132b";
21 sha256 = "0bayahnxar1q6wvf9cb6p8gsfw98w0wqp715hs4r7apmddwk9v7n";
22 }
23 else
24 { # Use master branch (broken on 4.8)
25 version = "unstable-2016-05-02";
26 rev = "5a7083bd98b38ef3bd223f7ee531d58f4fb0fe7c";
27 sha256 = "0d455kajvn5xav9iilqy7s1qvsy4yb8vzjjxx7bvcgp7aj9ljvdp";
28 }
29 ;
30in
31
32stdenv.mkDerivation rec {
33 name = "facetimehd-${version}-${kernel.version}";
34 version = srcParams.version;
35
36 src = fetchFromGitHub {
37 owner = "patjak";
38 repo = "bcwc_pcie";
39 inherit (srcParams) rev sha256;
40 };
41
42 preConfigure = ''
43 export INSTALL_MOD_PATH="$out"
44 '';
45
46 hardeningDisable = [ "pic" ];
47
48 nativeBuildInputs = kernel.moduleBuildDependencies;
49
50 makeFlags = [
51 "KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
52 ];
53
54 meta = with stdenv.lib; {
55 homepage = https://github.com/patjak/bcwc_pcie;
56 description = "Linux driver for the Facetime HD (Broadcom 1570) PCIe webcam";
57 license = licenses.gpl2;
58 maintainers = with maintainers; [ womfoo grahamc ];
59 platforms = [ "i686-linux" "x86_64-linux" ];
60 };
61}