Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-20.03 36 lines 1.9 kB view raw
1<section xmlns="http://docbook.org/ns/docbook" 2 xmlns:xlink="http://www.w3.org/1999/xlink" 3 xml:id="sec-language-lua"> 4 <title>Lua</title> 5 6 <para> 7 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.) 8 </para> 9 10 <para> 11 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: 12<programlisting> 13fileSystem = buildLuaPackage { 14 name = "filesystem-1.6.2"; 15 src = fetchurl { 16 url = "https://github.com/keplerproject/luafilesystem/archive/v1_6_2.tar.gz"; 17 sha256 = "1n8qdwa20ypbrny99vhkmx8q04zd2jjycdb5196xdhgvqzk10abz"; 18 }; 19 meta = { 20 homepage = "https://github.com/keplerproject/luafilesystem"; 21 hydraPlatforms = stdenv.lib.platforms.linux; 22 maintainers = with maintainers; [ flosse ]; 23 }; 24}; 25</programlisting> 26 </para> 27 28 <para> 29 Though, more complicated package should be placed in a seperate file in <link 30 xlink:href="https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/lua-modules"><filename>pkgs/development/lua-modules</filename></link>. 31 </para> 32 33 <para> 34 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. 35 </para> 36</section>