fix(nix): pin cargoLock outputHashes for git deps, resync bun.lock - #606
Open
andreszb wants to merge 1 commit into
Open
fix(nix): pin cargoLock outputHashes for git deps, resync bun.lock#606andreszb wants to merge 1 commit into
andreszb wants to merge 1 commit into
Conversation
bun.lock's workspace dependency ranges (react ^19.2.4, etc.) had drifted from package.json's (react ^19.2.8) since package.json was bumped without refreshing the lockfile. bun install --frozen-lockfile detects that drift and re-resolves every direct dependency against the npm registry, which breaks network-sandboxed builds (e.g. Nix). Regenerated bun.lock via `bun install` to resync it with package.json. Also pin cargoLock.outputHashes for the two git-sourced crates (apple-codesign, isideload) that buildRustPackage/importCargoLock can't otherwise vendor a hash for automatically.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
nix build github:nab138/iloaderfails at currentmain(8547013). Two independent bugs stack — fixing the first uncovers the second.1. Missing vendor hashes for the two git-sourced crates
src-tauri/Cargo.lockhas twogit+dependencies rather than crates.io releases:apple-codesign 0.1.0—git+https://github.com/Dadoum/apple-crates#a505b2aisideload 0.3.17—git+https://github.com/nab138/isideload?branch=apple-codesign-quick#3d42025importCargoLockcan't derive a fixed-output hash for a git dependency, so it has to be given one explicitly viacargoLock.outputHashes. Without that, evaluation fails immediately:Fixes #602. Fixes #594 — though note #594's secondary remark about the reported version string is a separate matter and isn't addressed here.
2.
bun.lock's workspace ranges had drifted frompackage.jsonWith bug 1 fixed, the Rust side compiles and the frontend fails instead:
package.jsonwas bumped for 14 packages (react→^19.2.8,vite→^8.2.0,typescript→~6.0.3, …) withoutbun.lock's workspace front-matter being refreshed — it still recorded^19.2.4/^8.0.7/~6.0.2.bun i --frozen-lockfileresponds to that drift by re-resolving every direct dependency against the npm registry.This is invisible in CI:
build.ymlhas network access, so the re-resolve just succeeds — it passed on 8547013. A Nix build has no network in the sandbox, so it fails there instead.The
packagessection ofbun.lockwas already correct: it resolvedreact@19.2.8,vite@8.2.0,typescript@6.0.3etc., all satisfying the newer ranges. Only the front-matter was stale.Fix
flake.nix— addcargoLock.outputHashesfor the two git crates.bun.lock— regenerated withbun installagainst an unmodifiedpackage.json.Verification
Hashes independently reproduced with
nix-prefetch-git --fetch-submodules(matchingfetchgit's defaults, which is whatimportCargoLockcalls):a505b2asha256-1ajD3aHa6mUuMYVH8jluIh49J0vKTp4vrfX4T2i3oTg=maintip of Dadoum/apple-crates3d42025sha256-oGE+dY68Gv1rmTSHCycakkSCMvUN9YjZHB1gJSikuho=apple-codesign-quickbun.lockchange is inert for everyone except Nix. The diff is 16 insertions / 16 deletions, entirely inside the workspacedependencies/devDependenciesfront-matter — nopackagesentry, no integrity hash, and nolockfileVersionchanged. The vendored dependency set is provably unaffected: bun2nix'sbunDepsderivation is byte-identical before and after the change (same…-bun-cache.drv). Nothing about what CI or contributors install changes.Builds:
nix build .#defaultsucceeds, and the flake also builds consumed as an input in a NixOS system closure.default.nix/shell.nixare flake-compat wrappers, so they pick this up automatically.Maintenance note
outputHasheskeys are name+version andimportCargoLockforces them, so bumping either crate inCargo.lockwill now hard-error untilflake.nixis updated too:That's a loud failure rather than a silent one, but worth knowing about. To refresh: set the value to
lib.fakeHash, runnix build, and read the expected hash back out of the mismatch error.