Skip to content

Commit 643427f

Browse files
author
Test User
committed
refactor(nix): fetch dependencies from bun.lock
Use Bun's recorded source integrities instead of hashing its installed layout. Keep native Bun responsible for patches and peer contexts. Remove hash calibration and manual lock synchronization. Closes anomalyco#49063
1 parent 7405f93 commit 643427f

16 files changed

Lines changed: 491 additions & 428 deletions

‎.github/workflows/bot-nix-hashes.yml‎

Lines changed: 0 additions & 161 deletions
This file was deleted.

‎.github/workflows/check-nix.yml‎

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,29 @@ jobs:
1919
nix-eval:
2020
if: ${{ !github.event.pull_request.draft }}
2121
runs-on: blacksmith-4vcpu-ubuntu-2404
22-
timeout-minutes: 15
22+
timeout-minutes: 60
2323
steps:
2424
- name: Checkout repository
2525
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2626

27+
- name: Detect dependency input changes
28+
id: dependencies
29+
env:
30+
BASE_REV: ${{ github.event.pull_request.base.sha || github.event.before }}
31+
run: |
32+
set -euo pipefail
33+
if [[ "$GITHUB_EVENT_NAME" == "workflow_dispatch" ]]; then
34+
echo "changed=true" >> "$GITHUB_OUTPUT"
35+
exit 0
36+
fi
37+
git fetch --no-tags --depth=1 origin "$BASE_REV"
38+
changed=$(git diff --name-only "$BASE_REV" HEAD -- \
39+
bun.lock package.json '**/package.json' flake.nix flake.lock \
40+
nix patches .github/workflows/check-nix.yml)
41+
if [[ -n "$changed" ]]; then
42+
echo "changed=true" >> "$GITHUB_OUTPUT"
43+
fi
44+
2745
- name: Setup Nix
2846
uses: nixbuild/nix-quick-install-action@2c9db80fb984ceb1bcaa77cdda3fdf8cfba92035 # v34
2947

@@ -41,8 +59,8 @@ jobs:
4159
4260
SYSTEMS="x86_64-linux aarch64-linux aarch64-darwin"
4361
PACKAGES="opencode"
44-
# TODO: move 'desktop' to PACKAGES when #11755 is fixed
45-
OPTIONAL_PACKAGES="desktop"
62+
# TODO: move 'opencode-desktop' to PACKAGES when #11755 is fixed
63+
OPTIONAL_PACKAGES="opencode-desktop"
4664
4765
echo ""
4866
echo "=== Evaluating packages for all systems ==="
@@ -95,3 +113,11 @@ jobs:
95113
96114
echo ""
97115
echo "=== All evaluations passed ==="
116+
117+
- name: Check Bun lock source import
118+
if: steps.dependencies.outputs.changed == 'true'
119+
run: nix develop --command bun nix/check-lock.ts
120+
121+
- name: Check CLI runtime and Desktop build
122+
if: steps.dependencies.outputs.changed == 'true'
123+
run: nix build .#checks.x86_64-linux.runtime .#opencode-desktop --max-jobs auto --no-link -L

‎CONTRIBUTING.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ Follow package-specific instructions in nearby `AGENTS.md` files. After changing
7373

7474
Follow the repository [style guide](./AGENTS.md).
7575

76+
### Nix packaging
77+
78+
Nix reads package URLs and integrity hashes directly from `bun.lock`, then uses bun2nix to prepare Bun's offline cache. Bun installs the original lockfile, links workspaces and peers, and applies patches. CLI and Desktop share these dependencies.
79+
80+
Changing `bun.lock` updates Nix dependencies automatically. There is no generated lockfile, aggregate `node_modules` hash, or hash-update workflow to maintain.
81+
82+
Build the CLI and run the installed color and service-discovery checks:
83+
84+
```bash
85+
nix build .#opencode
86+
nix build ".#checks.$(nix eval --impure --raw --expr builtins.currentSystem).runtime"
87+
```
88+
89+
CI checks the lock reader, installed CLI runtime, and Desktop build when dependency inputs change. The reader supports lockfile v1 registry, GitHub, and HTTP sources with recorded integrity; unsupported formats fail explicitly.
90+
7691
## Pull Requests
7792

7893
### Link Issues When Required

‎flake.lock‎

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)