Last active
May 5, 2025 03:34
-
-
Save Enzime/21383b0dd3d9c97aea393c17d1d917d8 to your computer and use it in GitHub Desktop.
Skip stdenv and use cached build logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x | |
NIXPKGS=$(nix flake metadata --json | jq -r '.path') | |
STDENV_STORE_PATH=$(nix eval --raw $NIXPKGS#legacyPackages.aarch64-linux.stdenv.outPath) | |
STDENV_STORE_PATH_HASH=$(echo $STDENV_STORE_PATH | cut -c 12-43) | |
if ! curl --head --fail "https://cache.nixos.org/$STDENV_STORE_PATH_HASH.narinfo"; then | |
exit 125 | |
fi | |
XCTEST_STORE_PATH=$(nix eval --raw $NIXPKGS#legacyPackages.aarch64-linux.swiftPackages.XCTest.outPath) | |
XCTEST_STORE_PATH_HASH=$(echo $XCTEST_STORE_PATH | cut -c 12-43) | |
if curl --head --fail "https://cache.nixos.org/$XCTEST_STORE_PATH_HASH.narinfo"; then | |
exit 0 | |
fi | |
XCTEST_DRV_PATH=$(nix eval --raw $NIXPKGS#legacyPackages.aarch64-linux.swiftPackages.XCTest.drvPath) | |
XCTEST_DRV_SUFFIX=$(echo $XCTEST_DRV_PATH | cut -c 12-) | |
if ! curl --head --fail "https://cache.nixos.org/log/$XCTEST_DRV_SUFFIX"; then | |
if nix build --no-link --print-build-logs $NIXPKGS#legacyPackages.aarch64-linux.swiftPackages.XCTest; then | |
exit 0 | |
fi | |
fi | |
if nix log $NIXPKGS#legacyPackages.aarch64-linux.swiftPackages.XCTest | grep "error: no such module 'Foundation'"; then | |
exit 1 | |
else | |
exit 125 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment