From 3eac27984266416a1a75622b6474ac137eb73002 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 04:56:18 +0000 Subject: [PATCH 1/4] Initial plan From f0f0f9a6eac929528c1271714868730643f9974f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 05:05:48 +0000 Subject: [PATCH 2/4] Update flake.nix for macOS 26 and add GitHub Actions build workflow Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com> --- .github/workflows/build_publish.yml | 32 +++++++++++++++++++++++++++++ flake.nix | 17 +++++++++++---- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 8b13789..8f2ab1e 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -1 +1,33 @@ +name: Build and Test +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: macos-15 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Show Swift version + run: | + swift --version + xcodebuild -version + + - name: Build with swiftc + run: | + xcrun swiftc -o WhoseDefaultBrowser main.swift + + - name: Verify binary exists + run: | + test -f WhoseDefaultBrowser && echo "Build successful!" || exit 1 + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: WhoseDefaultBrowser + path: WhoseDefaultBrowser diff --git a/flake.nix b/flake.nix index 4ae1a3d..387b05d 100644 --- a/flake.nix +++ b/flake.nix @@ -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) + /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 ''; installPhase = '' mkdir -p $out/bin From 45721f809aaeb2ffbf7916c38f5f29b98a282d7e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 05:11:24 +0000 Subject: [PATCH 3/4] Add explicit permissions to GitHub Actions workflow Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com> --- .github/workflows/build_publish.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index 8f2ab1e..d6dedb4 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [main] +permissions: + contents: read + jobs: build: runs-on: macos-15 From 9c6a2b8db7df2be2e4b8ab9ccded65e647fa93a6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 13 Jan 2026 12:09:43 +0000 Subject: [PATCH 4/4] Use nix build in GitHub Actions instead of direct swiftc commands Co-authored-by: koalazub <7111524+koalazub@users.noreply.github.com> --- .github/workflows/build_publish.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml index d6dedb4..f227a63 100644 --- a/.github/workflows/build_publish.yml +++ b/.github/workflows/build_publish.yml @@ -16,21 +16,24 @@ jobs: - 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 swiftc + - name: Build with Nix run: | - xcrun swiftc -o WhoseDefaultBrowser main.swift + nix build .#default --print-build-logs - name: Verify binary exists run: | - test -f WhoseDefaultBrowser && echo "Build successful!" || exit 1 + test -f result/bin/WhoseDefaultBrowser && echo "Build successful!" || exit 1 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: WhoseDefaultBrowser - path: WhoseDefaultBrowser + path: result/bin/WhoseDefaultBrowser