query
On this page

makeLuaWriter

pkgs.writers.makeLuaWriter

Functor
Docs pulled from | This Revision | 15 minutes ago


makeLuaWriter takes lua and compatible luaPackages and produces lua script writer, which validates the script with luacheck at build time. If any libraries are specified, lua.withPackages is used as interpreter, otherwise the "bare" lua is used.


Noogle detected

This is a Functor

Learn about functors

Implementation

The following is the current implementation of this function.

makeLuaWriter =
    lua: luaPackages: buildLuaPackages: name:
    {
      libraries ? [ ],
      ...
    }@args:
    makeScriptWriter (
      (builtins.removeAttrs args [ "libraries" ])
      // {
        interpreter = lua.interpreter;
        # if libraries == []
        # then lua.interpreter
        # else (lua.withPackages (ps: libraries)).interpreter
        # This should support packages! I just cant figure out why some dependency collision happens whenever I try to run this.
        check = (
          writeDash "luacheck.sh" ''
            exec ${buildLuaPackages.luacheck}/bin/luacheck "$1"
          ''
        );
      }
    ) name;