Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pkgs/by-name/ap/apple-sdk/common/fetch-sdk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
urls,
version,
hash,

# Include man pages
includeMan ? lib.toInt (lib.versions.major version) >= 15,
}:

fetchurl {
Expand All @@ -29,10 +32,17 @@ fetchurl {

src=Library/Developer/CommandLineTools/SDKs/MacOSX${lib.versions.majorMinor version}.sdk

# Remove unwanted binaries, man pages, and folders from the SDK.
rm -rf $src/usr/bin $src/usr/share $src/System/Library/Perl
# Remove unwanted binaries and folders from the SDK.
rm -rf $src/usr/bin $src/System/Library/Perl
if [[ -z "${toString includeMan}" ]]; then
rm -rf $src/usr/share
fi

mkdir -p "$out"
cp -rd $src/* "$out"
'';

passthru = {
inherit includeMan;
};
}
29 changes: 29 additions & 0 deletions pkgs/by-name/ap/apple-sdk/common/split-man-pages-output.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
lib,
stdenv,
}:

self: super: {
# The SDK includes man pages for basic command-line utilities
# shipped with macOS as well as others that may conflict with
# those provided by Nixpkgs.
#
# We split them out into a separate output to prevent poluting
# devShells. Furthermore, we name this output `sdkman` rather than
# the regular `man`/`devman` in preparation for this issue being
# solved:
#
# <https://github.com/NixOS/nix/issues/9550>
outputs = (super.outputs or [ "out" ]) ++ [ "sdkman" ];
outputMan = "sdkman";

buildPhase =
super.buildPhase or ""
+ ''
if [[ -d "usr/share/man" ]]; then
echo "Moving man pages to sdkman output"
mkdir -p "$sdkman/share"
mv usr/share/man $sdkman/share/
fi
'';
}
2 changes: 1 addition & 1 deletion pkgs/by-name/ap/apple-sdk/metadata/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
"https://web.archive.org/web/20250210234739/https://swcdn.apple.com/content/downloads/36/33/072-44426-A_G1AII30AST/ddbss9h6gse6a32rg6luosbrm6vgniu033/CLTools_macOSNMOS_SDK.pkg"
],
"version": "15.2",
"hash": "sha256-OP5Ah/JnSZ6sD42BD5vGDmikgFzjsfFBmz1hvQD1dOI="
"hash": "sha256-8L4CEkGlG5xDHLQX5dbublnCPI0RuMzso+v+QVQea5Y="
}
}
7 changes: 5 additions & 2 deletions pkgs/by-name/ap/apple-sdk/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ let
sdkVersions.${darwinSdkMajorVersion}
or (lib.throw "Unsupported SDK major version: ${darwinSdkMajorVersion}");
sdkVersion = sdkInfo.version;
src = fetchSDK sdkInfo;

fetchSDK = callPackage ./common/fetch-sdk.nix { };

Expand All @@ -38,6 +39,9 @@ let
(callPackage ./common/remove-disallowed-packages.nix { })
(callPackage ./common/process-stubs.nix { })
]
++ lib.optionals (src.passthru.includeMan) [
(callPackage ./common/split-man-pages-output.nix { })
]
# Avoid infinite recursions by not propagating certain packages, so they can themselves build with the SDK.
++ lib.optionals (!enableBootstrap) [
(callPackage ./common/propagate-inputs.nix { })
Expand All @@ -53,8 +57,7 @@ stdenvNoCC.mkDerivation (
lib.extends phases (finalAttrs: {
pname = "apple-sdk";
inherit (sdkInfo) version;

src = fetchSDK sdkInfo;
inherit src;

dontConfigure = true;

Expand Down