summary refs log tree commit diff
path: root/pkgs/development/lua-modules/generic/default.nix
blob: 71e1f7c05e6e661b5db3a08e0e0a9012089d8ebf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{ lua, writeText, toLuaModule }:

{ disabled ? false, ... } @ attrs:

if disabled then
  throw "${attrs.name} not supported by interpreter lua-${lua.luaversion}"
else
  toLuaModule( lua.stdenv.mkDerivation (
    {
      makeFlags = [
        "PREFIX=$(out)"
        "LUA_LIBDIR=$(out)/lib/lua/${lua.luaversion}"
        "LUA_INC=-I${lua}/include"
      ];
    }
    //
    attrs
    //
    {
      name = "lua${lua.luaversion}-" + attrs.name;
      propagatedBuildInputs = [
        lua # propagate it for its setup-hook
      ];
    }
  ) )