diff options
author | Mykola Orliuk <virkony@gmail.com> | 2023-04-29 18:37:42 +0200 |
---|---|---|
committer | Mykola Orliuk <virkony@gmail.com> | 2023-04-29 19:26:41 +0200 |
commit | 82e9b3f35800dd0e838b78727b95138d72203dd3 (patch) | |
tree | 1f95e0112728dcef6e567f872450082175852566 /pkgs/development/lua-modules | |
parent | 7287c0e076c3fd69d55e96cdc5c46e951bed01d4 (diff) |
lua.lib: lift toLua to top in generateLuarocksConfig
With asBindings option of toLua we can generate whole block of global variables assignments.
Diffstat (limited to 'pkgs/development/lua-modules')
-rw-r--r-- | pkgs/development/lua-modules/lib.nix | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/pkgs/development/lua-modules/lib.nix b/pkgs/development/lua-modules/lib.nix index 467e73c5e7e7c..64a40fa79602b 100644 --- a/pkgs/development/lua-modules/lib.nix +++ b/pkgs/development/lua-modules/lib.nix @@ -109,31 +109,31 @@ rec { externalDepsDirs = map (x: builtins.toString x) (lib.filter (lib.isDerivation) externalDeps); - in '' - local_cache = "" - -- To prevent collisions when creating environments, we install the rock - -- files into per-package subdirectories - rocks_subdir = ${toLua {} rocksSubdir} - -- first tree is the default target where new rocks are installed, - -- any other trees in the list are treated as additional sources of installed rocks for matching dependencies. - rocks_trees = ${toLua {} ( + in toLua { asBindings = true; } ({ + local_cache = ""; + # To prevent collisions when creating environments, we install the rock + # files into per-package subdirectories + rocks_subdir = rocksSubdir; + # first tree is the default target where new rocks are installed, + # any other trees in the list are treated as additional sources of installed rocks for matching dependencies. + rocks_trees = ( [{name = "current"; root = "${placeholder "out"}"; rocks_dir = "current"; }] ++ rocksTrees - )} - '' + lib.optionalString lua.pkgs.isLuaJIT '' - -- Luajit provides some additional functionality built-in; this exposes - -- that to luarock's dependency system - rocks_provided = ${toLua {} { + ); + } // lib.optionalAttrs lua.pkgs.isLuaJIT { + # Luajit provides some additional functionality built-in; this exposes + # that to luarock's dependency system + rocks_provided = { jit = "${lua.luaversion}-1"; ffi = "${lua.luaversion}-1"; luaffi = "${lua.luaversion}-1"; bit = "${lua.luaversion}-1"; - }} - '' + '' - -- For single-output external dependencies - external_deps_dirs = ${toLua {} externalDepsDirs} - -- Some needed machinery to handle multiple-output external dependencies, - -- as per https://github.com/luarocks/luarocks/issues/766 - variables = ${toLua {} (depVariables // extraVariables)} - ''; + }; + } // { + # For single-output external dependencies + external_deps_dirs = externalDepsDirs; + # Some needed machinery to handle multiple-output external dependencies, + # as per https://github.com/luarocks/luarocks/issues/766 + variables = (depVariables // extraVariables); + }); } |