-
Notifications
You must be signed in to change notification settings - Fork 0
Fix build: Update flake.nix for macOS 26 xcodebuild and add CI workflow #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
3eac279
f0f0f9a
45721f8
9c6a2b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,39 @@ | ||
| name: Build and Test | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: macos-15 | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install Nix | ||
| uses: DeterminateSystems/nix-installer-action@main | ||
|
|
||
| - name: Show Swift version | ||
| run: | | ||
| swift --version | ||
| xcodebuild -version | ||
|
|
||
| - name: Build with Nix | ||
| run: | | ||
| nix build .#default --print-build-logs | ||
|
|
||
| - name: Verify binary exists | ||
| run: | | ||
| test -f result/bin/WhoseDefaultBrowser && echo "Build successful!" || exit 1 | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: WhoseDefaultBrowser | ||
| path: result/bin/WhoseDefaultBrowser | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,10 +31,19 @@ | |||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
| buildInputs = [ pkgs.darwin.apple_sdk.frameworks.CoreServices ]; | ||||||||||||||||||||||||||||||
| buildPhase = '' | ||||||||||||||||||||||||||||||
| export PATH=$PATH:/usr/bin:/usr/local/bin | ||||||||||||||||||||||||||||||
| export SDKROOT=$(xcrun --show-sdk-path) | ||||||||||||||||||||||||||||||
| export MACOSX_DEPLOYMENT_TARGET=10.15 | ||||||||||||||||||||||||||||||
| xcrun swiftc -o WhoseDefaultBrowser main.swift | ||||||||||||||||||||||||||||||
| export PATH="/usr/bin:/usr/local/bin:$PATH" | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Use the latest SDK and Swift from the system's Xcode | ||||||||||||||||||||||||||||||
| export SDKROOT=$(/usr/bin/xcrun --sdk macosx --show-sdk-path) | ||||||||||||||||||||||||||||||
| export DEVELOPER_DIR=$(/usr/bin/xcode-select -p) | ||||||||||||||||||||||||||||||
| export MACOSX_DEPLOYMENT_TARGET=15.0 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | ||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||
| # Use xcodebuild for compilation (compatible with macOS 26+ Xcode) | |
| # Use xcrun/swiftc from the system's Xcode for compilation |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
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.
| -sdk "$SDKROOT" \ | |
| -sdk "$SDKROOT" \ | |
| # Nix uses "aarch64-darwin" as the system name, while Apple toolchains use "arm64" for the same architecture. |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
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.
| 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 \ |
There was a problem hiding this comment.
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.