Skip to content

Add support for using arity 3 tarball hash value without needing a prefetch - #108

Open
mtalexan wants to merge 1 commit into
nix-community:masterfrom
mtalexan:add-lockfile-tarball-hash-support
Open

mtalexan wants to merge 1 commit into
nix-community:masterfrom
mtalexan:add-lockfile-tarball-hash-support

Conversation

@mtalexan

Copy link
Copy Markdown

/closes #107

The arity 3 format tarball has a content hash as the 3rd part. We can use this to avoid needing to do a prefetch on the tarball to derive the hash.

Example arity 3 format:

    "xlsx": ["xlsx@https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz", { "bin": { "xlsx": "./bin/xlsx.njs" } }, "sha512-oLDq3jw7AcLqKWH2AhCpVTZl8mf6X2YReP+Neh0SJUzV/BdZYjth94tG5toiMB1PPrYtxOCfaoUCkvtuH+3AJA=="],

This was already being parsed, but the 3rd value was being ignored when it was provided. The common utility function that handles the tarball was expanded to take an optional hash value, so it now handles either case based on whether the hash is provided or not.

…efetch.

The arity 3 format tarball has a content hash as the 3rd part. We can use this to avoid
needing to do a prefetch on the tarball.
@jerome-benoit

Copy link
Copy Markdown

Related, but separate from this parser fix: Bun 1.4.4 changes HTTP tarball cache keys from URL Wyhash to integrity-based names. Bun 1.4.3 versus 1.4.4.

The current creator arguments receive neither integrity nor the consumer Bun version, so preserving the fetch SRI alone does not fix that lookup.

Reproduced on Linux x86_64 with this HTTP fixture: the generated cache installs offline under Bun 1.4.2; Bun 1.4.4 reports --offline: "cache-fixture" is not in the cache. Renaming only the HTTP cache entry to its integrity-based name makes the same frozen install and package execution pass.

Is consumer-version-aware HTTP cache creation already planned, here or elsewhere? Otherwise, would a separate producer fix be appropriate, forwarding the original SRI and selected Bun through fetchBunDeps? This compatibility belongs in bun2nix rather than project-specific cache-format adapters.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add bun.lock hash support for explicit tarball dependencies

3 participants