darwin.apple-source-releases: add mkAppleDerivation
This is a replacement for the family of `appleDerivation` functions currently used. It is patterned after the `mkDerivation` used in the BSD package sets. It also provides additional support for using Meson to build source releases.
This commit is contained in:
@@ -228,15 +228,18 @@ in
|
||||
self:
|
||||
|
||||
let
|
||||
macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage'; };
|
||||
developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage'; };
|
||||
macosPackages_11_0_1 = import ./macos-11.0.1.nix { inherit applePackage' callPackage; };
|
||||
developerToolsPackages_11_3_1 = import ./developer-tools-11.3.1.nix { inherit applePackage' callPackage; };
|
||||
|
||||
applePackage' = namePath: version: sdkName: sha256:
|
||||
let
|
||||
pname = builtins.head (lib.splitString "/" namePath);
|
||||
appleDerivation' = stdenv: appleDerivation'' stdenv pname version sdkName sha256;
|
||||
appleDerivation = appleDerivation' stdenv;
|
||||
callPackage = self.newScope { inherit appleDerivation' appleDerivation; python3 = pkgs.buildPackages.python3Minimal; };
|
||||
callPackage = self.newScope {
|
||||
inherit appleDerivation' appleDerivation mkAppleDerivation;
|
||||
python3 = pkgs.buildPackages.python3Minimal;
|
||||
};
|
||||
in callPackage (./. + "/${namePath}");
|
||||
|
||||
applePackage = namePath: sdkName: sha256: let
|
||||
@@ -244,6 +247,12 @@ let
|
||||
version = versions.${sdkName}.${pname};
|
||||
in applePackage' namePath version sdkName sha256;
|
||||
|
||||
callPackage = self.newScope { inherit mkAppleDerivation; };
|
||||
|
||||
mkAppleDerivation = pkgs.callPackage ./mkAppleDerivation.nix {
|
||||
inherit (pkgs.darwin) bootstrapStdenv xcodeProjectCheckHook;
|
||||
};
|
||||
|
||||
# Only used for bootstrapping. It’s convenient because it was the last version to come with a real makefile.
|
||||
adv_cmds-boot = applePackage "adv_cmds/boot.nix" "osx-10.5.8" "sha256-/OJLNpATyS31W5nWfJgSVO5itp8j55TRwG57/QLT5Fg=" {};
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Generated using: ./generate-sdk-packages.sh developer-tools 11.3.1
|
||||
|
||||
{ applePackage' }:
|
||||
{ applePackage', callPackage }:
|
||||
|
||||
{
|
||||
bootstrap_cmds = applePackage' "bootstrap_cmds" "116" "developer-tools-11.3.1" "06nw99ajkd264vdi6n2zv252ppxp3wx3120hqf3jqdh6c1wavy0b" {};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Generated using: ./generate-sdk-packages.sh macos 11.0.1
|
||||
|
||||
{ applePackage' }:
|
||||
{ applePackage', callPackage }:
|
||||
|
||||
{
|
||||
CommonCrypto = applePackage' "CommonCrypto" "60178.40.2" "macos-11.0.1" "129gsxhhcxqycg0zjrdrz2ay4dv2ih1ckafqh33qrc499z8dam2p" {};
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
let
|
||||
versions = builtins.fromJSON (builtins.readFile ./versions.json);
|
||||
in
|
||||
|
||||
{
|
||||
lib,
|
||||
bootstrapStdenv,
|
||||
fetchFromGitHub,
|
||||
meson,
|
||||
ninja,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
xcodeProjectCheckHook,
|
||||
}:
|
||||
|
||||
let
|
||||
hasBasenamePrefix = prefix: file: lib.hasPrefix prefix (baseNameOf file);
|
||||
in
|
||||
lib.makeOverridable (
|
||||
attrs:
|
||||
let
|
||||
attrs' = if lib.isFunction attrs then attrs else _: attrs;
|
||||
attrsFixed = lib.fix attrs';
|
||||
stdenv' =
|
||||
if attrsFixed.noCC or false then
|
||||
stdenvNoCC
|
||||
else if attrsFixed.noBootstrap or false then
|
||||
stdenv
|
||||
else
|
||||
bootstrapStdenv;
|
||||
in
|
||||
stdenv'.mkDerivation (
|
||||
lib.extends (
|
||||
self: super:
|
||||
assert super ? releaseName;
|
||||
let
|
||||
inherit (super) releaseName;
|
||||
info = versions.${releaseName};
|
||||
files = lib.filesystem.listFilesRecursive (lib.path.append ./. releaseName);
|
||||
mesonFiles = lib.filter (hasBasenamePrefix "meson") files;
|
||||
in
|
||||
# You have to have at least `meson.build.in` when using xcodeHash to trigger the Meson
|
||||
# build support in `mkAppleDerivation`.
|
||||
assert super ? xcodeHash -> lib.length mesonFiles > 0;
|
||||
{
|
||||
pname = super.pname or releaseName;
|
||||
inherit (info) version;
|
||||
|
||||
src = super.src or fetchFromGitHub {
|
||||
owner = "apple-oss-distributions";
|
||||
repo = releaseName;
|
||||
rev = info.rev or "${releaseName}-${info.version}";
|
||||
inherit (info) hash;
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
meta = {
|
||||
homepage = "https://opensource.apple.com/releases/";
|
||||
license = lib.licenses.apple-psl20;
|
||||
maintainers = lib.teams.darwin.members;
|
||||
platforms = lib.platforms.darwin;
|
||||
} // super.meta or { };
|
||||
}
|
||||
// lib.optionalAttrs (super ? xcodeHash) {
|
||||
postUnpack =
|
||||
super.postUnpack or ""
|
||||
+ lib.concatMapStrings (
|
||||
file:
|
||||
if baseNameOf file == "meson.build.in" then
|
||||
"substitute ${lib.escapeShellArg "${file}"} \"$sourceRoot/meson.build\" --subst-var version\n"
|
||||
else
|
||||
"cp ${lib.escapeShellArg "${file}"} \"$sourceRoot/\"${lib.escapeShellArg (baseNameOf file)}\n"
|
||||
) mesonFiles;
|
||||
|
||||
xcodeProject = super.xcodeProject or "${releaseName}.xcodeproj";
|
||||
|
||||
nativeBuildInputs = super.nativeBuildInputs or [ ] ++ [
|
||||
meson
|
||||
ninja
|
||||
xcodeProjectCheckHook
|
||||
];
|
||||
|
||||
mesonBuildType = "release";
|
||||
}
|
||||
) attrs'
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,2 @@
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user