lispPackages.nyxt: build a binary

This commit is contained in:
Michael Raskin 2020-10-25 01:30:44 +02:00
parent 619173b237
commit 4d73ca7b48
2 changed files with 19 additions and 2 deletions

View File

@ -95,8 +95,8 @@ nix_lisp_run_single_form(){
nix_lisp_build_system(){
NIX_LISP_FINAL_PARAMETERS=(
"$NIX_LISP_EXEC_CODE" "(progn
(asdf:make :$1)
(loop for s in (list $(for i in $3; do echo ":$i"; done)) do (asdf:make s)))"
(asdf:load-system :$1)
(loop for s in (list $(for i in $3; do echo ":$i"; done)) do (asdf:load-system s)))"
"$NIX_LISP_EXEC_CODE" "(progn
(setf (asdf/system:component-entry-point (asdf:find-system :$1)) ${2:-nil})
#+cffi(setf cffi:*foreign-library-directories*
@ -106,15 +106,19 @@ nix_lisp_build_system(){
:separator \":\")
for l in sb-alien::*shared-objects*
for ns := (sb-alien::shared-object-namestring l)
do (format *error-output* \"Searching alien object ~s in ~s~%\"
ns libpath)
do (and (> (length ns) 0) (not (equal (elt ns 0) \"/\"))
(let*
((prefix (find-if (lambda (s) (probe-file (format nil \"~a/~a\" s ns))) libpath))
(fullpath (and prefix (format nil \"~a/~a\" prefix ns))))
(when fullpath
(format *error-output* \"Found: ~s~%\" fullpath)
(setf
(sb-alien::shared-object-namestring l) fullpath
(sb-alien::shared-object-pathname l) (probe-file fullpath)))))
)
$4
(asdf:perform (quote asdf:program-op) :$1)
)")
}

View File

@ -129,6 +129,19 @@ let lispPackages = rec {
buildSystems = [ "nyxt" "nyxt-ext" ];
description = "Browser";
overrides = x: {
postInstall = ''
echo "Building nyxt binary"
NIX_LISP_PRELAUNCH_HOOK='
nix_lisp_build_system nyxt/gtk-application \
"(asdf/system:component-entry-point (asdf:find-system :nyxt/gtk-application))" \
"" "(format *error-output* \"Alien objects:~%~s~%\" sb-alien::*shared-objects*)"
' "$out/bin/nyxt-lisp-launcher.sh"
cp "$out/lib/common-lisp/nyxt/nyxt" "$out/bin/"
'';
};
deps = with pkgs.lispPackages; [
alexandria
bordeaux-threads