1<section xmlns="http://docbook.org/ns/docbook"
2 xmlns:xlink="http://www.w3.org/1999/xlink"
3 xml:id="sec-language-lua">
4
5<title>Lua</title>
6
7<para>
8 Lua packages are built by the <varname>buildLuaPackage</varname> function. This function is
9 implemented
10 in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules/generic/default.nix">
11 <filename>pkgs/development/lua-modules/generic/default.nix</filename></link>
12 and works similarly to <varname>buildPerlPackage</varname>. (See
13 <xref linkend="sec-language-perl"/> for details.)
14</para>
15
16<para>
17 Lua packages are defined
18 in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/lua-packages.nix"><filename>pkgs/top-level/lua-packages.nix</filename></link>.
19 Most of them are simple. For example:
20
21 <programlisting>
22fileSystem = buildLuaPackage {
23 name = "filesystem-1.6.2";
24 src = fetchurl {
25 url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz";
26 sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz";
27 };
28 meta = {
29 homepage = "https://github.com/keplerproject/luafilesystem";
30 hydraPlatforms = stdenv.lib.platforms.linux;
31 maintainers = with maintainers; [ flosse ];
32 };
33};
34 </programlisting>
35</para>
36
37<para>
38 Though, more complicated package should be placed in a seperate file in
39 <link
40 xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules"><filename>pkgs/development/lua-modules</filename></link>.
41</para>
42<para>
43 Lua packages accept additional parameter <varname>disabled</varname>, which defines
44 the condition of disabling package from luaPackages. For example, if package has
45 <varname>disabled</varname> assigned to <literal>lua.luaversion != "5.1"</literal>,
46 it will not be included in any luaPackages except lua51Packages, making it
47 only be built for lua 5.1.
48</para>
49
50</section>
51