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.
This commit is contained in:
parent
4ea6c0c58b
commit
2191b7662d
@ -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" ]
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user