diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 804f16bf0..cbc764baa 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -10,6 +10,11 @@ jobs: uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry - name: Check Zig cache hash run: nix develop -c ./nix/build-support/check-zig-cache-hash.sh # diff --git a/.github/workflows/release-tip.yml b/.github/workflows/release-tip.yml index 590fd8a5a..23bc2431d 100644 --- a/.github/workflows/release-tip.yml +++ b/.github/workflows/release-tip.yml @@ -48,6 +48,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + # Setup Sparkle - name: Setup Sparkle env: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d0ea907e..700e73c16 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,11 +31,41 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + # Cross-compile the binary. We always use static building for this # because its the only way to access the headers. - name: Test Build run: nix develop -c zig build -Dstatic=true -Dapp-runtime=glfw -Dtarget=${{ matrix.target }} + build-nix: + strategy: + matrix: + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + needs: test + steps: + - name: Checkout code + uses: actions/checkout@v4 + + # Install Nix and use that to run our tests so our environment matches exactly. + - uses: cachix/install-nix-action@v24 + with: + nix_path: nixpkgs=channel:nixos-unstable + + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + + - name: Test NixOS package build + run: nix build .#ghostty + build-macos: runs-on: ghcr.io/cirruslabs/macos-ventura-xcode:latest needs: test @@ -51,6 +81,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + # GhosttyKit is the framework that is built from Zig for our native # Mac app to access. - name: Build GhosttyKit @@ -61,6 +97,7 @@ jobs: # Nix breaks xcodebuild so this has to be run outside. - name: Build Ghostty.app run: cd macos && xcodebuild + build-windows: runs-on: windows-2019 # this will not stop other jobs from running @@ -126,6 +163,12 @@ jobs: with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry + - name: test run: nix develop -c zig build -Dapp-runtime=none test @@ -145,6 +188,11 @@ jobs: - uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry - name: prettier check run: nix develop -c prettier --check . @@ -155,5 +203,10 @@ jobs: - uses: cachix/install-nix-action@v24 with: nix_path: nixpkgs=channel:nixos-unstable + # Use cache to minimize build times. + - name: Setup Nix cache + uses: DeterminateSystems/magic-nix-cache-action@main + with: + diagnostic-endpoint: "" # disable telemetry - name: alejandra check run: nix develop -c alejandra --check . diff --git a/nix/package.nix b/nix/package.nix index fccb0a143..2dc69543c 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -138,11 +138,17 @@ in else "$out/share/terminfo" } - mkdir -p $terminfo/share - cp -r "$terminfo_src" $terminfo/share/terminfo + mkdir -p "$out/nix-support" - mkdir -p $shell_integration - cp -r $out/share/shell-integration $shell_integration/shell-integration + mkdir -p "$terminfo/share" + mv "$terminfo_src" "$terminfo/share/terminfo" + ln -sf "$terminfo/share/terminfo" "$terminfo_src" + echo "$terminfo" >> "$out/nix-support/propagated-user-env-packages" + + mkdir -p "$shell_integration" + mv "$out/share/ghostty/shell-integration" "$shell_integration/shell-integration" + ln -sf "$shell_integration/shell-integration" "$out/share/ghostty/shell-integration" + echo "$shell_integration" >> "$out/nix-support/propagated-user-env-packages" ''; meta = with lib; {