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 default: fs.lua init.lua nl.lua svc.lua
test: test:
ln -s . anoia
fennel test.fnl fennel test.fnl
%.lua: %.fnl %.lua: %.fnl

View file

@ -10,10 +10,15 @@ in stdenv.mkDerivation {
src = ./.; src = ./.;
nativeBuildInputs = [ fennel ]; nativeBuildInputs = [ fennel ];
buildInputs = with lua.pkgs; [ luafilesystem ]; buildInputs = with lua.pkgs; [ luafilesystem ];
outputs = [ "out" "dev" ];
doCheck = true; doCheck = true;
checkPhase = "make test";
installPhase = '' installPhase = ''
mkdir -p "$out/share/lua/${lua.luaversion}/${pname}" mkdir -p "$out/share/lua/${lua.luaversion}/${pname}"
cp *.lua "$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)) (local { : hash : base64url } (require :init))
(import-macros { : expect= } :anoia.assert) (import-macros { : expect= } :assert)
(expect= (hash "") 5381) (expect= (hash "") 5381)

View file

@ -31,6 +31,7 @@ in writeScriptBin "fennelrepl" ''
package.cpath = ${lib.strings.escapeShellArg luacpath} .. ";" .. (package.cpath or "") package.cpath = ${lib.strings.escapeShellArg luacpath} .. ";" .. (package.cpath or "")
local fennel = require "fennel" local fennel = require "fennel"
table.insert(package.loaders or package.searchers,1, fennel.searcher) 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") local more_fennel = os.getenv("FENNEL_PATH")
if more_fennel then if more_fennel then