Skip to content

Commit 198dd82

Browse files
committed
Step 4
.agents/codebase-insights.txt: appimage-scripts/build_appimage2.sh: nix/packages/default.nix: Signed-off-by: Tzanko Matev <[email protected]>
1 parent 2c77efc commit 198dd82

File tree

3 files changed

+28
-10
lines changed

3 files changed

+28
-10
lines changed

.agents/codebase-insights.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
- `ct record` verifies that `codetracer_python_recorder` is importable before launching the db backend and prints actionable guidance if the module is missing or broken.
2525
- Sudoku test-program datasets include intentionally invalid boards (e.g., examples #3 and #6) with duplicate digits inside a sub-grid; solvers should detect and report these gracefully.
2626
- `appimage-scripts/build_appimage.sh` assumes a devshell: it invokes `nix build`/`nix eval` directly and runs `npm install`/`npx yarn`, so it needs host network access and the git worktree metadata that a pure derivation build lacks.
27-
- `appimage-scripts/build_appimage2.sh` relies on `packages.${system}.appimageDeps` producing an AppDir-like tree (bin/, lib/) with transitive libs resolved via `lddtree`, so a single `cp` seeds the AppDir.
27+
- `appimage-scripts/build_appimage2.sh` now consumes `packages.${system}.appimagePayload`, which layers the Rust binaries atop the dependency tree from `appimageDeps`, so the script just copies one derivation output into the AppDir.

appimage-scripts/build_appimage2.sh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ mkdir -p "${APP_DIR}"
3434
export NIX_CODETRACER_EXE_DIR="${APP_DIR}"
3535

3636
CURRENT_NIX_SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')
37-
APPIMAGE_DEPS=$(nix build "${ROOT_PATH}#packages.${CURRENT_NIX_SYSTEM}.appimageDeps" --no-link --print-out-paths | tail -n1)
37+
APPIMAGE_PAYLOAD=$(nix build "${ROOT_PATH}#packages.${CURRENT_NIX_SYSTEM}.appimagePayload" --no-link --print-out-paths | tail -n1)
3838

39-
cp -Lr "${APPIMAGE_DEPS}/." "${APP_DIR}/"
39+
cp -Lr "${APPIMAGE_PAYLOAD}/." "${APP_DIR}/"
4040

4141
chmod -R u+rwX "${APP_DIR}"
4242

@@ -84,14 +84,8 @@ exec "${HERE}/bin/ct_unwrapped" "$@"
8484
8585
EOF
8686

87-
# Build/setup db-backend
88-
bash "${ROOT_PATH}/appimage-scripts/build_db_backend.sh"
89-
90-
# Build/setup backend-manager
91-
bash "${ROOT_PATH}/appimage-scripts/build_backend_manager.sh"
92-
9387
# Ensure copied binaries are executable.
94-
chmod +x "${APP_DIR}/bin/"{cargo-stylus,ctags,curl,nargo,node,wazero}
88+
chmod +x "${APP_DIR}/bin/"{cargo-stylus,ctags,curl,nargo,node,wazero,db-backend,backend-manager}
9589

9690
chmod -R +x "${APP_DIR}/bin"
9791
chmod -R +x "${APP_DIR}/electron"

nix/packages/default.nix

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,30 @@
191191
chmod +x "$out/bin"/*
192192
'';
193193

194+
appimagePayload = pkgs.runCommand "codetracer-appimage-payload" {
195+
nativeBuildInputs = [
196+
pkgs.bashInteractive
197+
pkgs.coreutils
198+
];
199+
} ''
200+
set -euo pipefail
201+
202+
mkdir -p "$out"
203+
cp -R ${appimageDeps}/. "$out/"
204+
chmod -R u+w "$out"
205+
mkdir -p "$out/bin"
206+
207+
install_bin() {
208+
local src=$1
209+
local dest=$2
210+
cp -L "$src" "$out/bin/$(basename "$dest")"
211+
chmod +x "$out/bin/$(basename "$dest")"
212+
}
213+
214+
install_bin ${db-backend}/bin/db-backend db-backend
215+
install_bin ${backend-manager}/bin/backend-manager backend-manager
216+
'';
217+
194218
indexJavascript = stdenv.mkDerivation {
195219
name = "index.js";
196220
pname = "index.js";

0 commit comments

Comments
 (0)