diff --git a/.github/actions/nix-devshell/action.yaml b/.github/actions/nix-devshell/action.yaml deleted file mode 100644 index 4be99151..00000000 --- a/.github/actions/nix-devshell/action.yaml +++ /dev/null @@ -1,32 +0,0 @@ -name: "Setup Nix devshell" -description: "This action sets up a nix devshell environment" -runs: - using: "composite" - steps: - - name: Setup Nix - uses: nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30 - - # Using the cache is somehow slower, so we're not using it for now. - # - uses: nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3 - # with: - # # restore and save a cache using this key - # primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} - # # if there's no cache hit, restore a cache by this prefix - # restore-prefixes-first-match: nix-${{ runner.os }}- - # # collect garbage until Nix store size (in bytes) is at most this number - # # before trying to save a new cache - # # 1 GB = 1073741824 B - # gc-max-store-size-linux: 1073741824 - # # do purge caches - # purge: true - # # purge all versions of the cache - # purge-prefixes: nix-${{ runner.os }}- - # # created more than this number of seconds ago relative to the start of the `Post Restore` phase - # purge-created: 0 - # # except the version with the `primary-key`, if it exists - # purge-primary-key: never - - - name: Enter devshell - uses: nicknovitski/nix-develop@9be7cfb4b10451d3390a75dc18ad0465bed4932a # v1.2.1 - with: - arguments: ".#ci" diff --git a/.github/actions/setup-mise/action.yaml b/.github/actions/setup-mise/action.yaml new file mode 100644 index 00000000..17a55a0d --- /dev/null +++ b/.github/actions/setup-mise/action.yaml @@ -0,0 +1,10 @@ +name: "Setup mise" +description: "This action installs the tools pinned in mise.toml" +runs: + using: "composite" + steps: + - name: Setup mise + uses: jdx/mise-action@82a612c5ab8bcda7cc5db6b7e81a8e7584c3dc6e # v5.2.3 + with: + version: 2026.10.19 + cache: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 606685f6..5d0fdae2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,8 +42,8 @@ jobs: with: xcode-version: "26.5.0" - - name: Setup Nix - uses: ./.github/actions/nix-devshell + - name: Setup mise + uses: ./.github/actions/setup-mise - run: make test @@ -63,8 +63,8 @@ jobs: with: xcode-version: "26.5.0" - - name: Setup Nix - uses: ./.github/actions/nix-devshell + - name: Setup mise + uses: ./.github/actions/setup-mise - run: make fmt @@ -79,8 +79,8 @@ jobs: fetch-tags: true persist-credentials: false - - name: Setup Nix - uses: ./.github/actions/nix-devshell + - name: Setup mise + uses: ./.github/actions/setup-mise - run: make lint env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ae35508..fb4adeff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,6 +35,7 @@ jobs: env: # See the test job in ci.yml. DEPOT_XCODE_CACHE_ENABLED: 0 + out: ${{ github.workspace }}/release steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 @@ -48,8 +49,8 @@ jobs: with: xcode-version: "26.5.0" - - name: Setup Nix - uses: ./.github/actions/nix-devshell + - name: Setup mise + uses: ./.github/actions/setup-mise - name: Authenticate to Google Cloud id: gcloud_auth @@ -81,7 +82,7 @@ jobs: uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: coder-desktop-build - path: ${{ github.workspace }}/outputs/out + path: ${{ env.out }} retention-days: 7 # Upload to release in non-dry-run mode @@ -121,8 +122,8 @@ jobs: fetch-tags: true persist-credentials: false - - name: Setup Nix - uses: ./.github/actions/nix-devshell + - name: Setup mise + uses: ./.github/actions/setup-mise - name: Update homebrew-coder env: diff --git a/.gitignore b/.gitignore index cae5c43f..92b4cdc0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,5 @@ -# Created by https://www.toptal.com/developers/gitignore/api/xcode,jetbrains,macos,direnv,swift,swiftpm,objective-c -# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,jetbrains,macos,direnv,swift,swiftpm,objective-c - -### direnv ### -.direnv -.envrc +# Created by https://www.toptal.com/developers/gitignore/api/xcode,jetbrains,macos,swift,swiftpm,objective-c +# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,jetbrains,macos,swift,swiftpm,objective-c ### JetBrains ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider @@ -294,7 +290,7 @@ xcuserdata **/.vscode/** buildServer.json -# End of https://www.toptal.com/developers/gitignore/api/xcode,jetbrains,macos,direnv,swift,swiftpm,objective-c +# End of https://www.toptal.com/developers/gitignore/api/xcode,jetbrains,macos,swift,swiftpm,objective-c *.entitlements app-signing.keychain-db diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 634e85af..4d5bb20f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,61 +17,32 @@ and bundle identifiers. ## Setting Up the Development Environment -To ensure a consistent and reliable development environment, we recommend using -[**Nix**](https://nix.dev/) with Flake support. All the tools required for -development are defined in the `flake.nix` file. +To ensure a consistent and reliable development environment, we use +[**mise**](https://mise.jdx.dev/) to install the tools required for development. +Their versions are pinned in `mise.toml`. -**Note:** Nix is the only supported development environment for this project. -While setups outside of Nix may work, we do not support custom tool installations -or address issues related to missing path setups or other tooling installation -problems. Using Nix ensures consistency across development environments and avoids -these potential issues. +**Note:** mise is the only supported way to install these tools. While other +setups may work, we do not support custom tool installations or address issues +related to missing path setups or other tooling installation problems. For +example, a Homebrew `swiftformat` may format the code differently from CI. -### Installing Nix with Flakes Enabled - -If you don’t already have Nix installed, you can: - -1. Use the [Determinate Systems installer](https://nixinstaller.com/) for a - simple setup. -2. Alternatively, use the [official installer](https://nixos.org/download.html) - and enable Flake support by adding the following to your Nix configuration: - - ```nix - experimental-features = nix-command flakes - ``` - -This project does **not** support non-Flake versions of Nix. - -### Entering the Development Environment - -Run the following command to enter the development environment with all necessary -tools: - -```bash -nix develop -``` - -### Using `direnv` for Environment Automation (Optional) - -As an optional recommendation, you can use [`direnv`](https://direnv.net/) to -automatically load and unload the Nix development environment when you navigate -to the project directory. After installing `direnv`, enable it for this project by: - -1. Adding the following line to your `.envrc` file in the project directory: +1. [Install mise](https://mise.jdx.dev/installing-mise.html). +2. From the project directory, [trust](https://mise.jdx.dev/cli/trust.html) its + `mise.toml`. mise asks for this because the file changes mise settings: ```bash - use flake + mise trust ``` -2. Allowing the `.envrc` file by running: +3. Install the tools: ```bash - direnv allow + mise install ``` -With `direnv`, the development environment will automatically be set up whenever -you enter the project directory. This step is optional but can significantly -streamline your workflow. +4. [Activate mise in your shell](https://mise.jdx.dev/getting-started.html#activate-mise), + so the pinned tools are on your `PATH` whenever you are in the project + directory. ## Generating the Xcode Project Files diff --git a/Makefile b/Makefile index 9c9e45c9..a4baa790 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,10 @@ SHELL := bash .SHELLFLAGS := -ceu +ifeq ($(filter oneshell,$(.FEATURES)),) +$(error GNU Make 3.82 or later is required for .SHELLFLAGS, but this is $(MAKE_VERSION). Install the tools with mise, see CONTRIBUTING.md) +endif + # This doesn't work on directories. # See https://stackoverflow.com/questions/25752543/make-delete-on-error-for-directory-targets .DELETE_ON_ERROR: diff --git a/flake.lock b/flake.lock deleted file mode 100644 index 5a6a2919..00000000 --- a/flake.lock +++ /dev/null @@ -1,61 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1793110635, - "narHash": "sha256-dhoW6VgFWlaodSY5jrBn+CF2FLmaUvDVgM7+C7T2+NM=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "31ecbaca1bdefa45dffc409f0250bd8039ea0010", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index dc109dd7..00000000 --- a/flake.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ - description = "Coder Desktop macOS"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - }; - - outputs = - { - nixpkgs, - flake-utils, - ... - }: - flake-utils.lib.eachSystem - (with flake-utils.lib.system; [ - aarch64-darwin - x86_64-darwin - ]) - ( - system: - let - pkgs = import nixpkgs { - inherit system; - }; - - formatter = pkgs.nixfmt; - in - { - inherit formatter; - - devShells = rec { - # Need to use a devshell for CI, as we want to reuse the already existing Xcode on the runner - ci = pkgs.mkShellNoCC { - buildInputs = with pkgs; [ - actionlint - clang - coreutils - gh - git - gnumake - swiftformat - swiftlint - xcbeautify - xcodegen - xcpretty - zizmor - ]; - shellHook = '' - # Copied from https://github.com/ghostty-org/ghostty/blob/c4088f0c73af1c153c743fc006637cc76c1ee127/nix/devShell.nix#L189-L199 - # We want to rely on the system Xcode tools in CI! - unset SDKROOT - unset DEVELOPER_DIR - # We need to remove the nix "xcrun" from the PATH. - export PATH=$(echo "$PATH" | awk -v RS=: -v ORS=: '$0 !~ /xcrun/ || $0 == "/usr/bin" {print}' | sed 's/:$//') - ''; - }; - - default = pkgs.mkShellNoCC { - buildInputs = - with pkgs; - [ - apple-sdk_15 - formatter - watchexec - ] - ++ ci.buildInputs; - }; - }; - } - ); -} diff --git a/mise.lock b/mise.lock new file mode 100644 index 00000000..e94ff2f0 --- /dev/null +++ b/mise.lock @@ -0,0 +1,143 @@ +# @generated - this file is auto-generated by `mise lock` https://mise.jdx.dev/dev-tools/mise-lock.html + +lockfile_version = 3 + +[[tools.actionlint]] +version = "1.7.12" +backend = "aqua:rhysd/actionlint" +specifiers = ["1.7.12"] + +[tools.actionlint."platforms.macos-arm64"] +checksum = "sha256:aba9ced2dee8d27fecca3dc7feb1a7f9a52caefa1eb46f3271ea66b6e0e6953f" +url = "https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_darwin_arm64.tar.gz" +url_api = "https://api.github.com/repos/rhysd/actionlint/releases/assets/384924893" +provenance = "github-attestations" + +[tools.actionlint."platforms.macos-x64"] +checksum = "sha256:5b44c3bc2255115c9b69e30efc0fecdf498fdb63c5d58e17084fd5f16324c644" +url = "https://github.com/rhysd/actionlint/releases/download/v1.7.12/actionlint_1.7.12_darwin_amd64.tar.gz" +url_api = "https://api.github.com/repos/rhysd/actionlint/releases/assets/384924880" +provenance = "github-attestations" + +[[tools.make]] +version = "4.4.1" +backend = "conda:make" +specifiers = ["4.4.1"] + +[tools.make.options] +channel = "conda-forge" + +[tools.make."platforms.macos-arm64"] +checksum = "sha256:9a913075a5c373ed7e12daa4f60d15fe5b0638eb806d79975bd6c498c8728ed6" +url = "https://conda.anaconda.org/conda-forge/osx-arm64/make-4.4.1-h63fc045_4.conda" +conda_deps = [] + +[tools.make."platforms.macos-x64"] +checksum = "sha256:01eb5a54d986b550da0698a95687228bd4bd241633ae5dfc4310d3153a150867" +url = "https://conda.anaconda.org/conda-forge/osx-64/make-4.4.1-hd77389f_4.conda" +conda_deps = [] + +[[tools.swiftformat]] +version = "0.64.3" +backend = "github:nicklockwood/SwiftFormat" +specifiers = ["0.64.3"] + +[tools.swiftformat.options] +no_app = "true" + +[tools.swiftformat."platforms.macos-arm64"] +checksum = "sha256:5caff00f02c440cc50d1dad588e949402c7cb271f5f8ae248a788164d21bf41a" +checksum_source = "mise-versions" +url = "https://github.com/nicklockwood/SwiftFormat/releases/download/0.64.3/swiftformat.zip" +url_api = "https://api.github.com/repos/nicklockwood/SwiftFormat/releases/assets/677644857" + +[tools.swiftformat."platforms.macos-x64"] +checksum = "sha256:5caff00f02c440cc50d1dad588e949402c7cb271f5f8ae248a788164d21bf41a" +checksum_source = "mise-versions" +url = "https://github.com/nicklockwood/SwiftFormat/releases/download/0.64.3/swiftformat.zip" +url_api = "https://api.github.com/repos/nicklockwood/SwiftFormat/releases/assets/677644857" + +[[tools.swiftlint]] +version = "0.65.1" +backend = "aqua:realm/SwiftLint" +specifiers = ["0.65.1"] + +[tools.swiftlint."platforms.macos-arm64"] +checksum = "sha256:c1e429b0599cf1b516f369a2d9ec04eaf0e436f3c12b637df8851fa52ff694d0" +checksum_source = "mise-versions" +url = "https://github.com/realm/SwiftLint/releases/download/0.65.1/portable_swiftlint.zip" +url_api = "https://api.github.com/repos/realm/SwiftLint/releases/assets/524187565" + +[tools.swiftlint."platforms.macos-x64"] +checksum = "sha256:c1e429b0599cf1b516f369a2d9ec04eaf0e436f3c12b637df8851fa52ff694d0" +checksum_source = "mise-versions" +url = "https://github.com/realm/SwiftLint/releases/download/0.65.1/portable_swiftlint.zip" +url_api = "https://api.github.com/repos/realm/SwiftLint/releases/assets/524187565" + +[[tools.watchexec]] +version = "2.5.1" +backend = "aqua:watchexec/watchexec" +specifiers = ["2.5.1"] + +[tools.watchexec."platforms.macos-arm64"] +checksum = "sha256:c5e405dd1109940b2510398d2182990c1be59063b94e11d7ace9c7b435cb1df1" +checksum_source = "mise-versions" +url = "https://github.com/watchexec/watchexec/releases/download/v2.5.1/watchexec-2.5.1-aarch64-apple-darwin.tar.xz" +url_api = "https://api.github.com/repos/watchexec/watchexec/releases/assets/384489930" + +[tools.watchexec."platforms.macos-x64"] +checksum = "sha256:bb74bf33286ff7f31dd8e763e017fbc0418360d88baefd35bc57d662d28394e2" +checksum_source = "mise-versions" +url = "https://github.com/watchexec/watchexec/releases/download/v2.5.1/watchexec-2.5.1-x86_64-apple-darwin.tar.xz" +url_api = "https://api.github.com/repos/watchexec/watchexec/releases/assets/384489931" + +[[tools.xcbeautify]] +version = "3.2.1" +backend = "aqua:cpisciotta/xcbeautify" +specifiers = ["3.2.1"] + +[tools.xcbeautify."platforms.macos-arm64"] +checksum = "sha256:ed32972e41bc3aa19588f8b0f4a0209ef70c663ad60bbf4ad84a2de73355d637" +checksum_source = "mise-versions" +url = "https://github.com/cpisciotta/xcbeautify/releases/download/3.2.1/xcbeautify-3.2.1-arm64-apple-macosx.zip" +url_api = "https://api.github.com/repos/cpisciotta/xcbeautify/releases/assets/388376615" + +[tools.xcbeautify."platforms.macos-x64"] +checksum = "sha256:ba65e8efc2ebe8c6f13393aaeb88a0ff849278d9480ee1496affaa3db781ac6e" +checksum_source = "mise-versions" +url = "https://github.com/cpisciotta/xcbeautify/releases/download/3.2.1/xcbeautify-3.2.1-x86_64-apple-macosx.zip" +url_api = "https://api.github.com/repos/cpisciotta/xcbeautify/releases/assets/388376611" + +[[tools.xcodegen]] +version = "2.44.1" +backend = "aqua:yonaskolb/XcodeGen" +specifiers = ["2.44.1"] + +[tools.xcodegen."platforms.macos-arm64"] +checksum = "sha256:a2e905fb68446e9bb4008cdfe2e13e3f176d0cbcca828b71770f8e53fca91b73" +checksum_source = "mise-versions" +url = "https://github.com/yonaskolb/XcodeGen/releases/download/2.44.1/xcodegen.zip" +url_api = "https://api.github.com/repos/yonaskolb/XcodeGen/releases/assets/275202612" + +[tools.xcodegen."platforms.macos-x64"] +checksum = "sha256:a2e905fb68446e9bb4008cdfe2e13e3f176d0cbcca828b71770f8e53fca91b73" +checksum_source = "mise-versions" +url = "https://github.com/yonaskolb/XcodeGen/releases/download/2.44.1/xcodegen.zip" +url_api = "https://api.github.com/repos/yonaskolb/XcodeGen/releases/assets/275202612" + +[[tools.zizmor]] +version = "1.31.1" +backend = "aqua:zizmorcore/zizmor" +specifiers = ["1.31.1"] + +[tools.zizmor."platforms.macos-arm64"] +checksum = "sha256:ad5aa633cd56215b11e6c51d51f90c7e6b22904a75047d1215abbd422f61d698" +url = "https://github.com/zizmorcore/zizmor/releases/download/v1.31.1/zizmor-aarch64-apple-darwin.tar.gz" +url_api = "https://api.github.com/repos/zizmorcore/zizmor/releases/assets/645467283" +provenance = "github-attestations" + +[tools.zizmor."platforms.macos-x64"] +checksum = "sha256:72ae63bb85b67229c06242f04195cb43927e9fab5f43803c6434dc701a517d61" +url = "https://github.com/zizmorcore/zizmor/releases/download/v1.31.1/zizmor-x86_64-apple-darwin.tar.gz" +url_api = "https://api.github.com/repos/zizmorcore/zizmor/releases/assets/645467287" +provenance = "github-attestations" diff --git a/mise.toml b/mise.toml new file mode 100644 index 00000000..2db3aad9 --- /dev/null +++ b/mise.toml @@ -0,0 +1,15 @@ +min_version = "2026.10.19" + +[settings] +lockfile = true + +[tools] +actionlint = "1.7.12" +# The Makefile needs GNU Make 3.82+ for .SHELLFLAGS, but macOS ships 3.81. +make = "4.4.1" +swiftformat = "0.64.3" +swiftlint = "0.65.1" +watchexec = "2.5.1" +xcbeautify = "3.2.1" +xcodegen = "2.44.1" +zizmor = "1.31.1" diff --git a/scripts/build.sh b/scripts/build.sh index e1589dbb..81666311 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -# Add standard Nix environment variables out="${out:-release}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"