Skip to content

Fix build: Update flake.nix for macOS 26 xcodebuild and add CI workflow#2

Merged
koalazub merged 4 commits intomainfrom
copilot/fix-build-issue
Jan 14, 2026
Merged

Fix build: Update flake.nix for macOS 26 xcodebuild and add CI workflow#2
koalazub merged 4 commits intomainfrom
copilot/fix-build-issue

Conversation

Copy link
Contributor

Copilot AI commented Jan 13, 2026

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

  • Use /usr/bin/xcrun with explicit --sdk macosx to pick up latest system Swift/Xcode
  • Set DEVELOPER_DIR via xcode-select -p for macOS 26 xcodebuild compatibility
  • Bump MACOSX_DEPLOYMENT_TARGET from 10.15 → 15.0
  • Add proper architecture targeting per system (arm64/x86_64)
/usr/bin/xcrun --sdk macosx swiftc \
  -o WhoseDefaultBrowser \
  -sdk "$SDKROOT" \
  -target ${if system == "aarch64-darwin" then "arm64" else "x86_64"}-apple-macosx15.0 \
  main.swift

GitHub Actions workflow

  • macos-15 runner with actions/checkout@v4
  • Installs Nix via DeterminateSystems/nix-installer-action
  • Builds using nix build .#default to leverage the flake.nix configuration
  • Verifies binary exists and uploads artifact
  • Explicit contents: read permissions
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix build issue</issue_title>
<issue_description></issue_description>

<agent_instructions>we want to make sure that the latest version of swiftc is being used, the flake is using the new xcodebuild that's been released with macOS 26 and that everything builds smoothly. We also need a GitHub workflow that tests the build so that when we merge we know it works
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI and others added 2 commits January 13, 2026 05:05
Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com>
Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix build issue with swiftc and xcodebuild Fix build: Update flake.nix for macOS 26 xcodebuild and add CI workflow Jan 13, 2026
Copilot AI requested a review from koalazub January 13, 2026 05:13
Copy link
Owner

@koalazub koalazub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you do it this way instead of leveraging flake.nix to run the commands? This is hacky, verbose, and fragile.

Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@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: e39154c9-b791-4ec9-a06b-cf304bdf5a36

Sorry for the inconvenience!

@koalazub
Copy link
Owner

@copilot try again

Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 13, 2026

@copilot try again

Updated the workflow to use nix build .#default instead of direct swiftc commands. The workflow now installs Nix via DeterminateSystems/nix-installer-action and leverages your flake.nix configuration for the build. See commit 9c6a2b8.

Copilot AI requested a review from koalazub January 13, 2026 12:13
@koalazub koalazub marked this pull request as ready for review January 14, 2026 00:40
Copilot AI review requested due to automatic review settings January 14, 2026 00:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

uses: actions/checkout@v4

- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
uses: DeterminateSystems/nix-installer-action@main
uses: DeterminateSystems/nix-installer-action@v13

Copilot uses AI. Check for mistakes.
# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
/usr/bin/xcrun --sdk macosx swiftc \
-o WhoseDefaultBrowser \
-sdk "$SDKROOT" \
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
-sdk "$SDKROOT" \
-sdk "$SDKROOT" \
# Nix uses "aarch64-darwin" as the system name, while Apple toolchains use "arm64" for the same architecture.

Copilot uses AI. Check for mistakes.
export DEVELOPER_DIR=$(/usr/bin/xcode-select -p)
export MACOSX_DEPLOYMENT_TARGET=15.0

# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
# Use xcodebuild for compilation (compatible with macOS 26+ Xcode)
# Use xcrun/swiftc from the system's Xcode for compilation

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +45
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 \
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 \

Copilot uses AI. Check for mistakes.
@koalazub koalazub merged commit 9a669ca into main Jan 14, 2026
8 of 9 checks passed
@koalazub koalazub deleted the copilot/fix-build-issue branch January 14, 2026 10:34
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.

Fix build issue

3 participants