The developers of Apple have released the Darwin source code for macOS 10.12 Sierra. Darwin comprises of the kernel, BSD portions, drivers, and developer tools. The source code can be found at the links provided.

macossourceThe lowest layers of macOS, including the kernel, BSD portions, and drivers are based mainly on open source technologies, collectively called Darwin. As such, Apple provides download links to the latest versions of these technologies for the open source community to learn and to use.

Source code: https://opensource.apple.com/release/os-x-1012.html

Original post: https://9to5mac.com/2016/11/24/apple-releases-macos-10-12-sierra-open-source-darwin-code/