sile: make it easier to setup a modified luaEnv when writing documents

This commit is contained in:
Doron Behar 2024-11-28 19:18:08 +02:00
parent 9a68795314
commit 7edacad9b7

View File

@ -110,41 +110,48 @@ stdenv.mkDerivation (finalAttrs: {
enableParallelBuilding = true; enableParallelBuilding = true;
passthru = { passthru = {
luaEnv = lua.withPackages ( # Use this passthru variable to add packages to your lua environment. Use
ps: # something like this in your development environment:
with ps; #
# myLuaEnv = lua.withPackages (
# ps: lib.attrVals (sile.passthru.luaPackages ++ [
# "lua-cjson"
# "lua-resty-http"
# ]) ps
# )
luaPackages =
[ [
cassowary "cassowary"
cldr "cldr"
fluent "fluent"
linenoise "linenoise"
loadkit "loadkit"
lpeg "lpeg"
lua-zlib "lua-zlib"
lua_cliargs "lua_cliargs"
luaepnf "luaepnf"
luaexpat "luaexpat"
luafilesystem "luafilesystem"
luarepl "luarepl"
luasec "luasec"
luasocket "luasocket"
luautf8 "luautf8"
penlight "penlight"
vstruct "vstruct"
# lua packages needed for testing # lua packages needed for testing
busted "busted"
luacheck "luacheck"
# packages needed for building api docs # packages needed for building api docs
ldoc "ldoc"
# NOTE: Add lua packages here, to change the luaEnv also read by `flake.nix` # NOTE: Add lua packages here, to change the luaEnv also read by `flake.nix`
] ]
++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [ ++ lib.optionals (lib.versionOlder lua.luaversion "5.2") [
bit32 "bit32"
] ]
++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [ ++ lib.optionals (lib.versionOlder lua.luaversion "5.3") [
compat53 "compat53"
] ];
); luaEnv = lua.withPackages (ps: lib.attrVals finalAttrs.finalPackage.passthru.luaPackages ps);
# Copied from Makefile.am # Copied from Makefile.am
tests.test = lib.optionalAttrs (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) ( tests.test = lib.optionalAttrs (!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)) (