diff options
author | Alyssa Ross <hi@alyssa.is> | 2024-02-26 16:20:28 +0100 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2024-02-26 16:20:28 +0100 |
commit | 647438344bfc1f77791391e2b4f98eef865c63dc (patch) | |
tree | ef580867fc6cc413940e4330d939cf1afda082cb /nixpkgs/pkgs/development/lua-modules/lib.nix | |
parent | b084c6a0fab7f32c904c5c8e8db8dddcefbe507f (diff) | |
parent | e3474e1d1e53b70e2b2af73ea26d6340e82f6b8b (diff) | |
download | nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.gz nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.bz2 nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.lz nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.xz nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.tar.zst nixlib-647438344bfc1f77791391e2b4f98eef865c63dc.zip |
Merge commit 'e3474e1d1e53'
Diffstat (limited to 'nixpkgs/pkgs/development/lua-modules/lib.nix')
-rw-r--r-- | nixpkgs/pkgs/development/lua-modules/lib.nix | 69 |
1 files changed, 38 insertions, 31 deletions
diff --git a/nixpkgs/pkgs/development/lua-modules/lib.nix b/nixpkgs/pkgs/development/lua-modules/lib.nix index 189e3464e81a..5841547073d3 100644 --- a/nixpkgs/pkgs/development/lua-modules/lib.nix +++ b/nixpkgs/pkgs/development/lua-modules/lib.nix @@ -74,7 +74,11 @@ rec { }; }); - /* generate luarocks config + + /* generate a luarocks config conforming to: + https://github.com/luarocks/luarocks/wiki/Config-file-format + + The config lists folders where to find lua dependencies Example: generateLuarocksConfig { @@ -89,7 +93,6 @@ rec { externalDeps ? [] # a list of lua derivations , requiredLuaRocks ? [] - , extraVariables ? {} , rocksSubdir ? "rocks-subdir" , ... }@args: let @@ -119,33 +122,37 @@ rec { externalDepsDirs = map (x: builtins.toString x) (lib.filter (lib.isDerivation) externalDeps); - 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.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 = externalDepsDirs; - # Some needed machinery to handle multiple-output external dependencies, - # as per https://github.com/luarocks/luarocks/issues/766 - variables = (depVariables // extraVariables); - } - // removeAttrs args [ "rocksSubdir" "extraVariables" "requiredLuaRocks" "externalDeps" ] - ); + + generatedConfig = ({ + 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.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 = externalDepsDirs; + # Some needed machinery to handle multiple-output external dependencies, + # as per https://github.com/luarocks/luarocks/issues/766 + variables = depVariables; + } + // removeAttrs args [ "requiredLuaRocks" "externalDeps" ] + ); + in generatedConfig; } |