From 835b6dd31394999a24e840b26aab6d93e4c75d3c Mon Sep 17 00:00:00 2001 From: schickling-assistant <261620128+schickling-assistant@users.noreply.github.com> Date: Sun, 8 Nov 2026 14:40:46 +0100 Subject: [PATCH] fix(nix): add codeload fallback for Ghostty package archives agent-identity: agent/dotfiles/fractal-product-lead agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.12.5 agent-runtime: OMP 18.12.5 agent-model: openai-codex/gpt-6.1-sol --- README.md | 5 +++++ flake.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/README.md b/README.md index b99a221b..804c4d6c 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,11 @@ transport; its revision and unpacked source hash are pinned in also verifies the native compatibility contract and runtime closure, runs the package tests, and checks installed completions. `nix develop` supplies the Rust toolchain and the same native artifact, without Zig. +GitHub-hosted Zig dependency archives use fixed-output downloads with the original +URL followed by an equivalent `codeload.github.com` fallback. URLs and archive +checksums come from Ghostty's pinned package manifest; the Zig package-cache +output hash is unchanged. This improves cold-cache build reliability without +changing runtime behavior or dependency contents. With Cargo (see the build requirements below): diff --git a/flake.nix b/flake.nix index 2e193d70..220bc378 100644 --- a/flake.nix +++ b/flake.nix @@ -56,6 +56,29 @@ hash = ghosttyContract.sourceHash; }; + # Keep transport mirrors separate from Zig's package content pins. + # Upstream's manifest supplies both archive byte hashes and cache names. + ghosttyGithubArchives = map + (package: + let + archiveUrl = builtins.match + "https://github.com/([^/]+/[^/]+)/archive/(.+)\\.tar\\.gz" + package.url; + in package // { + archive = pkgs.fetchurl { + urls = [ + package.url + "https://codeload.github.com/${builtins.elemAt archiveUrl 0}/tar.gz/${builtins.elemAt archiveUrl 1}" + ]; + sha256 = package.sha256; + }; + }) + (builtins.filter + (package: package.type == "archive" && builtins.match + "https://github.com/([^/]+/[^/]+)/archive/(.+)\\.tar\\.gz" + package.url != null) + (builtins.fromJSON (builtins.readFile "${ghosttySrc}/flatpak/zig-packages.json"))); + # Ghostty's zig package cache, in the layout `zig build --system ` # reads (one directory per package, named by its content hash). Fetched # with Ghostty's own script because `zig build --fetch` skips transitive @@ -79,6 +102,10 @@ buildPhase = '' runHook preBuild export ZIG_GLOBAL_CACHE_DIR="$TMPDIR/zig-global-cache" + ${lib.concatMapStringsSep "\n" (package: '' + substituteInPlace build.zig.zon.txt \ + --replace-fail ${lib.escapeShellArg package.url} ${lib.escapeShellArg (toString package.archive)} + '') ghosttyGithubArchives} ./nix/build-support/fetch-zig-cache.sh runHook postBuild '';