Commit Graph

16 Commits

Author SHA1 Message Date
Philip Taron
8526be06d2
luaPackages.requiredLuaModules: remove with lib statement 2024-08-18 06:31:16 -07:00
Matthieu C.
29cc0b4a6b generateLuarocksConfig: dont generate rocks_subdir by default
Goal is to make generateLuarocksConfig appropriate in more scenarios, in my case, to generate rocks.nvim luarocks config

We override the luarocks default for rocks_subdir to avoid conflicts when creating lua environments but it is not appropriate for other scenarios
so let's not default to it in the "lib" function.
2024-07-10 23:08:40 +02:00
Matthieu C.
8a0c6be458 generateLuarocksConfig: dont hardcode local_cache
I tried using luaLib.generateLuarocksConfig outside nixpkgs, to generate a rocks.nvim config but it adds a `local_cache = ""` configuration line that is painful to remove so let's not add it in the first place, and let the caller set it if needed.
2024-07-05 13:32:47 +02:00
Matthieu Coudron
50e877ed89 buildLuarocksPackage: accept structured luarocks config
There is an arbitrary mapping being done right now between
nixpkgs lua infrastructre and luarocks config schema.
This is confusing if you use lua so let's make it possible to use the
lua names in the nixpkgs, thanks to the lib.generators.toLua convertor.

The only nixpkgs thing to remember should be to put the config into `luarocksConfig`

`buildLuarocksPackage.extraVariables` should become `buildLuarocksPackage.luarocksConfig.variables`
2024-02-17 15:58:13 +01:00
Matthieu Coudron
2191b7662d 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.
2023-12-15 15:05:46 +01:00
Matthieu Coudron
54ca335a15 generateLuarocksConfig: add defaults to ease its usage 2023-10-14 22:00:16 +02:00
Matthieu Coudron
d87a6a99f6 luarocks: can be embedded with lua.withPackages
lua.withPackages only brings packages that have passthru.luaModule, which was not the case of luarocks (because it's built differently than other lua packages). We call toLuaModule on luarocks so that it is brought in a lua.withPackages call
2023-07-08 19:56:05 +02:00
Matthieu Coudron
8670e496ff
Merge pull request #227714 from ony/feature/generateLuarocksConfig-toLua
lua.lib: use toLua in generateLuarocksConfig
2023-05-01 18:53:22 +02:00
Mykola Orliuk
82e9b3f358 lua.lib: lift toLua to top in generateLuarocksConfig
With asBindings option of toLua we can generate whole block of global
variables assignments.
2023-04-29 19:26:41 +02:00
Mykola Orliuk
25f8a3f276 lua.lib: use toLua in generateLuarocksConfig 2023-04-23 19:46:14 +02:00
Matthieu Coudron
30a70671f4 buildLuaPackage: enable __structuredAttrs rocks
it makes overriding easier, instead of having to know internals to
decide which of `sqlite = prev.luaLib.overrideLuarocks prev.sqlite (drv: {` or
`sqlite = prev.sqlite.overrideAttrs (drv: {` just use the latter
2023-04-22 22:09:35 +02:00
Matthieu Coudron
0986a70be6 lua.lib: small fix
to avoid the error 'cfg.root_dir is null' see https://github.com/luarocks/luarocks/issues/1161 for details
2022-03-29 03:48:20 +02:00
Matthieu Coudron
253af9151f luaPackages: update
- luarocks-nix: bumped to pass args too, `package_X = callPackage ...`.
  It allows to remove the annoying `with self`.
  This new version disables tests (because broken) and now emits derivation
  with a callPackage in front.
- replaced X.override with lib.overrideLuarocks, it should be used
whenever buildInputs/extraVariables is changed since it impacts the
generated luarocks config.
Once structured attributes are in, it will be easier to have the
luarocks config generated by a hook and we probably will be able to
replace all overrideLuarocks by overrideAttrs.
2021-10-18 19:48:07 +02:00
Matthieu Coudron
abc36451d7 lua: create a folder for hooks
- moved lua hooks to a specific folder as I foresee to add more
- moved generateLuarocksConfig to lib
- fix getLuaPath
- removed the useless rockspecDir
2021-09-27 23:42:54 +02:00
Matthieu Coudron
496b8abf78 Apply suggestions from code review
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2021-09-12 03:03:56 +02:00
Matthieu Coudron
88842910b5 lua: introduced a lua lib
Goal is to improve separation between packages and utilities.
Can help with autocompletion/navigate nixpkgs faster.
Also it will help standardize how LUA_PATH is exported across packages,
so that one can more easily make lua changes across nixpkgs (for
    instance changing where lua modules are installed).
2021-09-12 03:03:56 +02:00