fix: build outside the guix container, run the binary inside
The dev shell (guix shell -D) has the full toolchain and network, so the build happens there. The isolated 'guix shell -C -N' container only runs the already-compiled binary, which needs just the GTK/WebKit C libraries via LD_LIBRARY_PATH. Also export WEBKIT_DISABLE_COMPOSITING_MODE and WEBKIT_DISABLE_DMABUF_RENDERER, without which WebKit renders a blank surface inside the sandbox. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f17f6a63e2
commit
269c2055f1
1 changed files with 20 additions and 6 deletions
|
|
@ -1,14 +1,26 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
BOOK_PATH=""
|
||||
BOOK_PATH="/home/user/static/3-I/books/delayed-call-toni-aleo.epub"
|
||||
|
||||
mkdir -p /tmp/guix-dbus
|
||||
echo "00000000000000000000000000000000" > /tmp/guix-dbus/machine-id
|
||||
|
||||
# --- Build outside the container ---------------------------------------------
|
||||
# The dev shell has the full toolchain and needs no display. --offline reuses
|
||||
# the cached build plan + package store (~/.local/state/cabal), so no hackage
|
||||
# index or network is required. GHC_PACKAGE_PATH must be unset for cabal.
|
||||
BUILD='unset GHC_PACKAGE_PATH; cabal build --offline svitak'
|
||||
guix shell -D -f guix.scm -- sh -c "$BUILD"
|
||||
SVITAK_BIN=$(guix shell -D -f guix.scm -- sh -c 'unset GHC_PACKAGE_PATH; cabal list-bin --offline svitak')
|
||||
|
||||
# --- Run inside the container ------------------------------------------------
|
||||
# The compiled binary statically links its Haskell deps; it only needs the C
|
||||
# libraries (GTK/WebKit) from the guix profile via LD_LIBRARY_PATH, plus the
|
||||
# Wayland/D-Bus sockets shared below. No cabal at runtime.
|
||||
guix shell -C -N --emulate-fhs \
|
||||
--share=$HOME/.cabal=$HOME/.cabal \
|
||||
--share=$PWD=$PWD \
|
||||
--share="$HOME/3-I/books"="$HOME/3-I/books" \
|
||||
--share="$HOME/static/3-I/books"="$HOME/static/3-I/books" \
|
||||
--share="$XDG_RUNTIME_DIR"="$XDG_RUNTIME_DIR" \
|
||||
--share="$XDG_RUNTIME_DIR/bus"="$XDG_RUNTIME_DIR/bus" \
|
||||
--share=/tmp/guix-dbus/machine-id=/etc/machine-id \
|
||||
|
|
@ -21,7 +33,9 @@ guix shell -C -N --emulate-fhs \
|
|||
bash -c "export LD_LIBRARY_PATH=\$GUIX_ENVIRONMENT/lib:\$LD_LIBRARY_PATH
|
||||
export GI_TYPELIB_PATH=\$GUIX_ENVIRONMENT/lib/girepository-1.0:\$GI_TYPELIB_PATH
|
||||
|
||||
echo \"LD_LIBRARY_PATH is: \$LD_LIBRARY_PATH\"
|
||||
# WebKitGTK renders a blank/white surface inside the sandboxed container
|
||||
# unless its GPU compositing + DMABUF renderer are disabled.
|
||||
export WEBKIT_DISABLE_COMPOSITING_MODE=1
|
||||
export WEBKIT_DISABLE_DMABUF_RENDERER=1
|
||||
|
||||
cabal clean
|
||||
cabal run svitak -- \"$BOOK_PATH\""
|
||||
\"$SVITAK_BIN\" \"$BOOK_PATH\""
|
||||
|
|
|
|||
Loading…
Reference in a new issue