all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Attila Lendvai <attila@lendvai.name>
To: Russell Sim <rsl@simopolis.xyz>
Cc: jgart <jgart@dismail.de>,
	John Kehayias <john.kehayias@protonmail.com>,
	guix-devel@gnu.org
Subject: Re: Should Guix support writing CLI Common Lisp scripts? (Think Roswell)
Date: Tue, 17 Jan 2023 10:07:10 +0000	[thread overview]
Message-ID: <VaWISnMF5WnoRep9eJ9KlxF6dYhCUinhavKZCuMAjwZVGrTCPfXclq4DXcBP1hy4v9_JKJim8U3MjyKXtwfFRf9Z989Dw-cYgyZlZprpSQ4=@lendvai.name> (raw)
In-Reply-To: <87k02cwmk3.fsf@simopolis.xyz>

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)



  reply	other threads:[~2023-01-17 10:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 18:14 Should Guix support writing CLI Common Lisp scripts? (Think Roswell) jgart
2022-12-27 18:25 ` John Kehayias
2023-01-16  1:01   ` Charles
2022-12-27 19:23 ` jgart
2022-12-27 19:58   ` Russell Sim
2022-12-27 21:06   ` jgart
2022-12-27 21:42     ` Russell Sim
2023-01-17 10:07       ` Attila Lendvai [this message]
2022-12-27 22:06   ` bokr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='VaWISnMF5WnoRep9eJ9KlxF6dYhCUinhavKZCuMAjwZVGrTCPfXclq4DXcBP1hy4v9_JKJim8U3MjyKXtwfFRf9Z989Dw-cYgyZlZprpSQ4=@lendvai.name' \
    --to=attila@lendvai.name \
    --cc=guix-devel@gnu.org \
    --cc=jgart@dismail.de \
    --cc=john.kehayias@protonmail.com \
    --cc=rsl@simopolis.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.