From 7bc10eb9b78c08ae1e64ae5e24db26cdb74c7834 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Wed, 8 Jan 2020 21:41:43 +0000 Subject: feat(buildLisp): Add initial, tiny example program --- nix/buildLisp/example/default.nix | 32 ++++++++++++++++++++++++++++++++ nix/buildLisp/example/lib.lisp | 6 ++++++ nix/buildLisp/example/main.lisp | 7 +++++++ 3 files changed, 45 insertions(+) create mode 100644 nix/buildLisp/example/default.nix create mode 100644 nix/buildLisp/example/lib.lisp create mode 100644 nix/buildLisp/example/main.lisp (limited to 'nix/buildLisp') diff --git a/nix/buildLisp/example/default.nix b/nix/buildLisp/example/default.nix new file mode 100644 index 0000000000..4a8cba6002 --- /dev/null +++ b/nix/buildLisp/example/default.nix @@ -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 + ]; +} diff --git a/nix/buildLisp/example/lib.lisp b/nix/buildLisp/example/lib.lisp new file mode 100644 index 0000000000..e557de4ae5 --- /dev/null +++ b/nix/buildLisp/example/lib.lisp @@ -0,0 +1,6 @@ +(defpackage lib-example + (:use :cl) + (:export :who)) +(in-package :lib-example) + +(defun who () "edef") diff --git a/nix/buildLisp/example/main.lisp b/nix/buildLisp/example/main.lisp new file mode 100644 index 0000000000..f98bb8409a --- /dev/null +++ b/nix/buildLisp/example/main.lisp @@ -0,0 +1,7 @@ +(defpackage example + (:use :cl :lib-example) + (:export :main)) +(in-package :example) + +(defun main () + (format t "i <3 ~S" (who))) -- cgit 1.4.1