feat(buildLisp): Add initial, tiny example program

This commit is contained in:
Vincent Ambo 2020-01-08 21:41:43 +00:00
parent bdad8f6642
commit 7bc10eb9b7
3 changed files with 45 additions and 0 deletions

View file

@ -0,0 +1,32 @@
{ pkgs, ... }:
let
inherit (pkgs.nix) buildLisp;
# Example Lisp library.
#
# Currently the `name` attribute is only used for the derivation
# itself, it has no practical implications.
libExample = buildLisp.library {
name = "lib-example";
srcs = [
./lib.lisp
];
};
# Example Lisp program.
#
# This builds & writes an executable for a program using the library
# above to disk.
#
# By default, buildLisp.program expects the entry point to be
# `$name:main`. This can be overridden by configuring the `main`
# attribute.
in buildLisp.program {
name = "example";
deps = [ libExample ];
srcs = [
./main.lisp
];
}

View file

@ -0,0 +1,6 @@
(defpackage lib-example
(:use :cl)
(:export :who))
(in-package :lib-example)
(defun who () "edef")

View file

@ -0,0 +1,7 @@
(defpackage example
(:use :cl :lib-example)
(:export :main))
(in-package :example)
(defun main ()
(format t "i <3 ~S" (who)))