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

{ disabled ? false
, propagatedBuildInputs ? [ ]
, ...
} @ 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.pname + "-" + attrs.version;
      propagatedBuildInputs = propagatedBuildInputs ++ [
        lua # propagate it for its setup-hook
      ];
    }
  ))