Fix build: Update flake.nix for macOS 26 xcodebuild and add CI workflow#2
Fix build: Update flake.nix for macOS 26 xcodebuild and add CI workflow#2
Conversation
Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com>
Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com>
koalazub
left a comment
There was a problem hiding this comment.
Why did you do it this way instead of leveraging flake.nix to run the commands? This is hacky, verbose, and fragile.
|
@koalazub Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
|
@copilot try again |
Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com>
Updated the workflow to use |
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Nix | ||
| uses: DeterminateSystems/nix-installer-action@main |
There was a problem hiding this comment.
Using the @main branch reference for a GitHub Action is not recommended for production workflows as it can introduce breaking changes without warning. Consider pinning to a specific version tag (e.g., @v1 or a specific commit SHA) to ensure build reproducibility and stability.
| uses: DeterminateSystems/nix-installer-action@main | |
| uses: DeterminateSystems/nix-installer-action@v13 |
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | ||
| /usr/bin/xcrun --sdk macosx swiftc \ | ||
| -o WhoseDefaultBrowser \ | ||
| -sdk "$SDKROOT" \ |
There was a problem hiding this comment.
The architecture mapping uses "arm64" and "x86_64" which are correct, but there's an inconsistency: the condition checks for "aarch64-darwin" but maps it to "arm64". While this works (arm64 and aarch64 refer to the same architecture), it would be more consistent to use "aarch64" in the target triple as well, or document why "arm64" is specifically chosen here for the Apple target triple.
| -sdk "$SDKROOT" \ | |
| -sdk "$SDKROOT" \ | |
| # Nix uses "aarch64-darwin" as the system name, while Apple toolchains use "arm64" for the same architecture. |
| export DEVELOPER_DIR=$(/usr/bin/xcode-select -p) | ||
| export MACOSX_DEPLOYMENT_TARGET=15.0 | ||
|
|
||
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) |
There was a problem hiding this comment.
The comment references "macOS 26" which uses incorrect version numbering. macOS versions follow a numbering scheme (e.g., macOS 10.x, macOS 11, 12, 13, 14, 15). "macOS 26" would be an unprecedented jump in versioning. This should be corrected to reference the actual macOS version being targeted.
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | |
| # Use xcrun/swiftc from the system's Xcode for compilation |
| export MACOSX_DEPLOYMENT_TARGET=15.0 | ||
|
|
||
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | ||
| /usr/bin/xcrun --sdk macosx swiftc \ | ||
| -o WhoseDefaultBrowser \ | ||
| -sdk "$SDKROOT" \ | ||
| -target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx15.0 \ |
There was a problem hiding this comment.
The MACOSX_DEPLOYMENT_TARGET has been increased from 10.15 to 15.0, which is a significant jump (skipping macOS versions 11 through 14). This may unnecessarily restrict compatibility with older macOS systems that could otherwise run this application. Unless there's a specific requirement for macOS 15+ features, consider using a lower deployment target to maintain broader compatibility.
| export MACOSX_DEPLOYMENT_TARGET=15.0 | |
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | |
| /usr/bin/xcrun --sdk macosx swiftc \ | |
| -o WhoseDefaultBrowser \ | |
| -sdk "$SDKROOT" \ | |
| -target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx15.0 \ | |
| export MACOSX_DEPLOYMENT_TARGET=10.15 | |
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | |
| /usr/bin/xcrun --sdk macosx swiftc \ | |
| -o WhoseDefaultBrowser \ | |
| -sdk "$SDKROOT" \ | |
| -target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx10.15 \ |
Build was failing due to outdated Swift compiler configuration and missing CI. Updates flake.nix to use system Xcode toolchain and adds GitHub Actions workflow for build verification.
flake.nix changes
/usr/bin/xcrunwith explicit--sdk macosxto pick up latest system Swift/XcodeDEVELOPER_DIRviaxcode-select -pfor macOS 26 xcodebuild compatibilityMACOSX_DEPLOYMENT_TARGETfrom 10.15 → 15.0arm64/x86_64)GitHub Actions workflow
macos-15runner withactions/checkout@v4DeterminateSystems/nix-installer-actionnix build .#defaultto leverage the flake.nix configurationcontents: readpermissionsOriginal prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.