diff options
author | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-12-14 22:43:05 +0100 |
---|---|---|
committer | Matthieu Coudron <886074+teto@users.noreply.github.com> | 2023-12-15 15:05:46 +0100 |
commit | 2191b7662d6db6db1336034f83c0546e5d2636b8 (patch) | |
tree | 22e49e97001bb837391b0d42c45e729c6e3738f6 /pkgs | |
parent | 4ea6c0c58bea95f22fbca81ae5edddc93b342b5e (diff) |
lua.lib: support arbitrary settings in generateLuarocksConfig
I wanted to improve the generated luarocks config.
The current system appends a string to it, this commit allows to pass
arbitrary nix code and have it autoconverted to lua along with the
default settings in the luarocks config.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/lua-modules/lib.nix | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/pkgs/development/lua-modules/lib.nix b/pkgs/development/lua-modules/lib.nix index a07b23ff9cd2..189e3464e81a 100644 --- a/pkgs/development/lua-modules/lib.nix +++ b/pkgs/development/lua-modules/lib.nix @@ -76,18 +76,23 @@ rec { /* generate luarocks config - generateLuarocksConfig { - externalDeps = [ { name = "CRYPTO"; dep = pkgs.openssl; } ]; - rocksSubdir = "subdir"; - }; + Example: + generateLuarocksConfig { + externalDeps = [ { name = "CRYPTO"; dep = pkgs.openssl; } ]; + rocksSubdir = "subdir"; + }; + + Type: + generateLuarocksConfig :: AttrSet -> String */ generateLuarocksConfig = { - externalDeps ? [] + externalDeps ? [] # a list of lua derivations , requiredLuaRocks ? [] , extraVariables ? {} , rocksSubdir ? "rocks-subdir" - }: let + , ... + }@args: let rocksTrees = lib.imap0 (i: dep: { name = "dep-${toString i}"; @@ -140,5 +145,7 @@ rec { # 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" ] + ); } |