package anoia assert macros and point fennelrepl at them

This commit is contained in:
Daniel Barlow 2024-04-20 14:59:14 +01:00
parent 7e19d80130
commit 8af4e9fd5b
4 changed files with 9 additions and 4 deletions

View file

@ -2,7 +2,6 @@
default: fs.lua init.lua nl.lua svc.lua
test:
ln -s . anoia
fennel test.fnl
%.lua: %.fnl

View file

@ -10,10 +10,15 @@ in stdenv.mkDerivation {
src = ./.;
nativeBuildInputs = [ fennel ];
buildInputs = with lua.pkgs; [ luafilesystem ];
outputs = [ "out" "dev" ];
doCheck = true;
checkPhase = "make test";
installPhase = ''
mkdir -p "$out/share/lua/${lua.luaversion}/${pname}"
cp *.lua "$out/share/lua/${lua.luaversion}/${pname}"
mkdir -p "$dev/share/lua/${lua.luaversion}/${pname}"
cp assert.fnl "$dev/share/lua/${lua.luaversion}/${pname}"
'';
}

View file

@ -1,5 +1,5 @@
(local { : hash : base64url } (require :anoia))
(import-macros { : expect= } :anoia.assert)
(local { : hash : base64url } (require :init))
(import-macros { : expect= } :assert)
(expect= (hash "") 5381)

View file

@ -31,6 +31,7 @@ in writeScriptBin "fennelrepl" ''
package.cpath = ${lib.strings.escapeShellArg luacpath} .. ";" .. (package.cpath or "")
local fennel = require "fennel"
table.insert(package.loaders or package.searchers,1, fennel.searcher)
fennel['macro-path'] = "${anoia.dev}/share/lua/${lua.luaversion}/?.fnl;" .. fennel['macro-path']
local more_fennel = os.getenv("FENNEL_PATH")
if more_fennel then