feat(buildLisp): Add initial, tiny example program
This commit is contained in:
parent
bdad8f6642
commit
7bc10eb9b7
3 changed files with 45 additions and 0 deletions
32
nix/buildLisp/example/default.nix
Normal file
32
nix/buildLisp/example/default.nix
Normal 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
|
||||
];
|
||||
}
|
6
nix/buildLisp/example/lib.lisp
Normal file
6
nix/buildLisp/example/lib.lisp
Normal file
|
@ -0,0 +1,6 @@
|
|||
(defpackage lib-example
|
||||
(:use :cl)
|
||||
(:export :who))
|
||||
(in-package :lib-example)
|
||||
|
||||
(defun who () "edef")
|
7
nix/buildLisp/example/main.lisp
Normal file
7
nix/buildLisp/example/main.lisp
Normal file
|
@ -0,0 +1,7 @@
|
|||
(defpackage example
|
||||
(:use :cl :lib-example)
|
||||
(:export :main))
|
||||
(in-package :example)
|
||||
|
||||
(defun main ()
|
||||
(format t "i <3 ~S" (who)))
|
Loading…
Reference in a new issue