about summary refs log tree commit diff
path: root/pkgs/development/lua-modules/generic/default.nix
blob: 7f07c6602dacd383d40cfa98ecb7550f1517d437 (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
26
27
{ lua, writeText, toLuaModule }:

{ disabled ? false
, propagatedBuildInputs ? [ ]
, makeFlags ? [ ]
, ...
} @ attrs:

if disabled then
  throw "${attrs.name} not supported by interpreter lua-${lua.luaversion}"
else
  toLuaModule (lua.stdenv.mkDerivation (
    attrs // {
      name = "lua${lua.luaversion}-" + attrs.pname + "-" + attrs.version;

      makeFlags = [
        "PREFIX=$(out)"
        "LUA_INC=-I${lua}/include"
        "LUA_LIBDIR=$(out)/lib/lua/${lua.luaversion}"
        "LUA_VERSION=${lua.luaversion}"
      ] ++ makeFlags;

      propagatedBuildInputs = propagatedBuildInputs ++ [
        lua # propagate it for its setup-hook
      ];
    }
  ))