[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Should Guix support writing CLI Common Lisp scripts? (Think Roswell)
From: |
Attila Lendvai |
Subject: |
Re: Should Guix support writing CLI Common Lisp scripts? (Think Roswell) |
Date: |
Tue, 17 Jan 2023 10:07:10 +0000 |
i have this, which uses guix when available, but works without it, too:
the entire file:
https://hub.darcs.net/hu.dwim/hu.dwim.environment/browse/bin/build-development-image.sh
it builds an executable SBCL image with every dependency of our project loaded.
we start it as an inferior for Slime.
the essence:
#!/usr/bin/env bash
#| -*- mode: lisp; coding: utf-8-unix -*-
SCRIPT_DIR=`dirname "$0"`
SCRIPT_DIR=`readlink -f ${SCRIPT_DIR}`
if command -v guix &> /dev/null; then
echo "Guix detected, entering the environment."
eval $(guix shell --search-paths libffi openssl sdl2 sdl2-gfx sdl2-image
sdl2-ttf bluez sqlite graphviz libfixposix pkg-config clang-toolchain
--development sbcl)
# this is needed for SBCL to find some of the .so files
export
LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${LIBRARY_PATH}"
echo "Setting LD_LIBRARY_PATH based on LIBRARY_PATH to ${LD_LIBRARY_PATH}"
fi
# NOTE: using --script would also imply --no-userinit (i.e. quicklisp wouldn't
get loaded from .sbclrc), so we use a different trick here to skip the first
line of this shell script file when reading it as a lisp file.
exec ${LISP} --noinform --end-runtime-options \
--eval "(require :asdf)" --eval "(asdf:load-system :asdf)" \
--eval "(with-open-file (s \"${0}\" :element-type 'character) (read-line s)
(load s))" \
--end-toplevel-options 2>&1 | tee ${BUILD_LOG_FILE}
# let's quit the shell part before the shell interpreter runs on the lisp stuff
below
kill -INT $$
# and from here follows the lisp part that gets "called" above |#
(in-package :cl-user)
[...]
--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“To put the world in order, we must first put the nation in order; to put the
nation in order, we must first put the family in order; to put the family in
order; we must first cultivate our personal life; we must first set our hearts
right.”
— Confucius (551–479 BC)