summary refs log tree commit diff
path: root/doc/languages-frameworks/lua.xml
blob: 39b086af4cb13c95abbea7f8819e8ae84db143f1 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<section xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xml:id="sec-language-lua">

<title>Lua</title>

<para>
  Lua packages are built by the <varname>buildLuaPackage</varname> function.  This function is
  implemented
  in <link xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules/generic/default.nix">
  <filename>pkgs/development/lua-modules/generic/default.nix</filename></link>
  and works similarly to <varname>buildPerlPackage</varname>. (See
  <xref linkend="sec-language-perl"/> for details.)
</para>

<para>
  Lua packages are defined
  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>.
  Most of them are simple. For example:

  <programlisting>
fileSystem = buildLuaPackage {
  name = "filesystem-1.6.2";
  src = fetchurl {
    url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz";
    sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz";
  };
  meta = {
    homepage = "https://github.com/keplerproject/luafilesystem";
    hydraPlatforms = stdenv.lib.platforms.linux;
    maintainers = with maintainers; [ flosse ];
  };
};
  </programlisting>
</para>

<para>
  Though, more complicated package should be placed in a seperate file in
  <link
  xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules"><filename>pkgs/development/lua-modules</filename></link>.
</para>
<para>
  Lua packages accept additional parameter <varname>disabled</varname>, which defines
  the condition of disabling package from luaPackages. For example, if package has
  <varname>disabled</varname> assigned to <literal>lua.luaversion != "5.1"</literal>,
  it will not be included in any luaPackages except lua51Packages, making it
  only be built for lua 5.1.
</para>

</section>