Skip to content

SDKBuilder: allow a local toolset and OpenAppleMacrosServer (offline sdk build) - #1

Closed
m9tdev wants to merge 1 commit into
mainfrom
offline-sdk-build
Closed

m9tdev wants to merge 1 commit into
mainfrom
offline-sdk-build

Conversation

@m9tdev

@m9tdev m9tdev commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

What

xtool sdk build downloads two files from GitHub releases:

  • the Linux toolset (darwin-tools-linux-llvm, toolset-<arch>.tar.gz)
  • OpenAppleMacrosServer-<arch>

This PR adds two optional environment variables that point at local copies:

Variable Effect
XTOOL_TOOLSET_TARBALL unpack this tarball instead of downloading the toolset
XTOOL_OAM_SERVER use this executable instead of downloading the macro server

Without the variables, xtool sdk build behaves as before.

Why

Builds without network cannot download: Nix builds (the sandbox has no network), other sandboxed package builds, and air-gapped machines. With this change, a package can fetch both files by pinned hash and give them to xtool.

Details:

  • tar runs through /bin/sh (it finds tar on PATH). The Nix build sandbox has no /usr/bin/env.
  • The macro server is written as a new file and then set to 0755. A copy of a read-only source (for example from /nix/store) would keep the read-only mode, and the next step would fail with "You don't have permission".

Tested

On this branch (6b1ad8f, based on main at d802c71), on NixOS x86_64:

  • swift build -c release --product xtool with Swift 6.4.0 (swift.org): builds.
  • xtool sdk build Xcode_27.xip in a network namespace with no network at all (unshare --net), with both variables set: builds the full SDK (iPhoneOS, iPhoneSimulator and MacOSX 27.0). OpenAppleMacrosServer in the result is writable (0755), and the source was a read-only file in /nix/store.
  • The same command without the variables fails at once with Network is unreachable, so nothing else downloads.

The same change (on the joshuaswarren/xtool fork) is in daily use in nix-apple-dev: the SDK builds in the Nix sandbox, and apps built with it run on an iPhone 12 mini (iOS 27.0).

…k build)

xtool sdk build downloads darwin-tools-linux-llvm's toolset and the
OpenAppleMacrosServer binary from GitHub releases. Builds without network
(Nix and other sandboxed package builds, air-gapped machines) cannot do that.

Two optional environment variables point at local copies instead:

- XTOOL_TOOLSET_TARBALL: a toolset-<arch>.tar.gz, unpacked with tar
- XTOOL_OAM_SERVER: an OpenAppleMacrosServer executable, copied (written as a
  new file, so a read-only source does not make the SDK copy read-only)

Without them, nothing changes.
@m9tdev

m9tdev commented Oct 11, 2026

Copy link
Copy Markdown
Owner Author

Review copy. Opened upstream: xtool-org#319

@m9tdev m9tdev closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant