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 00000000000..05a293083b7 --- /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; + }; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 2028d2ff14c..311cbd1f76a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9938,6 +9938,8 @@ let eject = utillinux; + facetimehd-firmware = callPackage ../os-specific/linux/firmware/facetimehd-firmware { }; + fanctl = callPackage ../os-specific/linux/fanctl { iproute = iproute.override { enableFan = true; }; };