about summary refs log tree commit diff
path: root/pkgs/os-specific/linux/firmware
diff options
context:
space:
mode:
authorEdward Tjörnhammar <ed@cflags.cc>2016-02-12 07:32:42 +0100
committerEdward Tjörnhammar <ed@cflags.cc>2016-02-12 07:32:42 +0100
commitfaf01ab0f7fed80e9a81886d36fc041db291c6a0 (patch)
tree9480a2158e43d38696608800006fc9081557b064 /pkgs/os-specific/linux/firmware
parent5bb195bda222965b47ce07ad172f034c27ce42f1 (diff)
parent46ecb25d68ba94248945ba9dfebe8fafcf70ed15 (diff)
Merge pull request #12038 from womfoo/facetimehd
facetimehd: PCIe webcam support for Macbooks
Diffstat (limited to 'pkgs/os-specific/linux/firmware')
-rw-r--r--pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix b/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix
new file mode 100644
index 0000000000000..05a293083b7fb
--- /dev/null
+++ b/pkgs/os-specific/linux/firmware/facetimehd-firmware/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, cpio, xz, pkgs }:
+
+let
+
+  version = "1.43";
+
+  dmgRange = "420107885-421933300"; # the whole download is 1.3GB, this cuts it down to 2MB
+
+  firmwareIn = "./System/Library/Extensions/AppleCameraInterface.kext/Contents/MacOS/AppleCameraInterface";
+  firmwareOut = "firmware.bin";
+  firmwareOffset = "81920";
+  firmwareSize = "603715";
+
+  # separated this here as the script will fail without the 'exit 0'
+  unpack = pkgs.writeScriptBin "unpack" ''
+    xzcat -Q $src | cpio --format odc -i -d ${firmwareIn}
+    exit 0
+  '';
+
+in
+
+stdenv.mkDerivation {
+
+  name = "facetimehd-firmware-${version}";
+
+  src = fetchurl {
+    url = "https://support.apple.com/downloads/DL1849/en_US/osxupd10.11.2.dmg";
+    sha256 = "1jw6sy9vj27amfak83cs2c7q856y4mk1wix3rl4q10yvd9bl4k9x";
+    curlOpts = "-r ${dmgRange}";
+  };
+
+  phases = [ "buildPhase" ];
+
+  buildInputs = [ cpio xz ];
+
+  buildPhase = ''
+    ${unpack}/bin/unpack
+    dd bs=1 skip=${firmwareOffset} count=${firmwareSize} if=${firmwareIn} of=${firmwareOut}.gz &> /dev/null
+    mkdir -p $out/lib/firmware/facetimehd
+    gunzip -c ${firmwareOut}.gz > $out/lib/firmware/facetimehd/${firmwareOut}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "facetimehd firmware";
+    homepage = https://support.apple.com/downloads/DL1849;
+    license = licenses.unfree;
+    maintainers = [ maintainers.womfoo ];
+    platforms = platforms.linux;
+  };
+
+}