Commit Graph

240 Commits

Author SHA1 Message Date
Matthieu C.
665f3f694b lua: take into propagated-build-inputs when building LUA_PATH
so far we ignored propagated-build-inputs
2024-06-12 15:31:04 +02:00
Matthieu C.
2ea757a029 luaPackages.luarocks: generate luarocks as well
When installing a lua package that depends on luarocks, luarocks was not
capable of recognizing the luarocks module: https://github.com/NixOS/nixpkgs/issues/316009 .

As explained here https://github.com/luarocks/luarocks/issues/1659,
luarocks needs a manifest to recognize the package.
I first attempted to generate a manifest with `luarocks-admin
make-manifest` on our current manual luarocks derivation but this ended
up being too hackish as the `make-manifest` requires a .rockspec or
.rock to work, which we had not.

It seemed simpled to just rename the current manual luarocks derivation to luarocks_bootstrap
in order to break cyclic dependencies in buildLuarocksPackage and add a
generated luarocks derivation. Previously it was impossible to test
luarocks because of the cyclic dependency but we will now be able to
test the generated derivation.
2024-05-31 19:59:29 +02:00
Sigmanificient
203a48ad35 pkgs/development: remove unused fetchpatch arguments 2024-05-24 02:53:57 +02:00
Matthieu C.
6427d04c23 lua:: reworked setup-hook to source utils.sh
which contains lua shell utilities that can be reused during the
creation of an environment.
Makes sense because the generation of LUA_PATH is a bit different than
other ecosystems.
2024-05-01 00:18:44 +02:00
Matthieu C.
a4d954080f lua: fixed the way to create environments
`paths =  requiredLuaModules (extraLibs ++ [ lua ] );` would discard lua
and so in absence of a propagated lua, the lua.withPackages would return
an empty bin/ directory.
2024-05-01 00:11:49 +02:00
Vladimír Čunát
3bcf0470d8
Revert #303176: "buildLuarocksPackage: rework fixup phase"
This reverts commit ddefcf284c.
Breakages need figuring out, reverting for now:
https://github.com/NixOS/nixpkgs/pull/303176#issuecomment-2053910614
2024-04-15 07:17:32 +02:00
Matthieu Coudron
ddefcf284c buildLuarocksPackage: rework fixup phase
I was working on lua tests, enabling nlua and I started overriding
postFixup, which removed the default phase for build-luarocks-package so
instead let's make it a proper phase.
2024-04-11 00:30:31 +02:00
Matthieu Coudron
c55b4dbcd2 lua: fix setup-hook *.lua matching
the setup-hook checks if a derivation contains lua files matching
lua_path patterns. We use bash's globstar extension for that but
`**.lua` doesn't return files in subfolders, it has to be `**/*.lua`.
Adjust the pattern accordingly.
2024-04-02 11:20:36 +02:00
Matthieu Coudron
b8be016426 lua.tests.checkSetupHook: test lua setup hook for http package
the 'http' package is an interesting one to test because all its lua
files are in a 'http' subfolder, ie., there is no share/lua/5.1/*.lua,
only share/lua/5.1/http/*.lua files unlike most packages. This tests we
can match those subfolders.
2024-04-02 11:20:36 +02:00
Matthieu Coudron
0c9417100f lua: update setup-hook to limit LUA_PATH size
now that the lua interpreters include working directories with `./?.lua`
in LUA_PATH, the current test includes every derivation which quickly
becomes unreadable and unpractical.
The test is adapted to add a folder only if it can find lua files in the
subfolder.
2024-03-16 14:37:10 +01:00
Matthieu Coudron
815d3683f7 lua.tests: update golden values for default LUA_PATH
when LUA_PATH contains `;;`, it is replaced by `;LUA_PATH_DEFAULT;` in
lua 5.1:
Updated 69ea087dff/loadlib.c (L599)
More recent versions might be smarter ?
65b07dd53d/loadlib.c (L301)
2024-03-16 14:37:10 +01:00
Matthieu Coudron
640cdcb814 lua: smarter/more correct patching
In order to have the 'reset' LUA_PATH (aka `;;`) work, and for purity
reasons(removing /usr paths) we(I) decided to patch the lua interpreters default LUA_PATH.
Turns out the interpreters have different defaults and the patch was too
coarse.
There is smarter patching that can be done via LUA_ROOT.

Also luajit doesn't need patching at all since LUA_ROOT is set via the
build system.
2024-03-16 14:37:09 +01:00
binarycat
b309d4fdcc lua: actually fix longstanding bug in lua envHook causing relative module imports to stop working
somehow, between all my testing, all the code review, and my code being copy-pasted into
other people's PRs, noone noticed the glaring issue in the singular line of code i committed.

there was a missing negation.  this has now been fixed.
2024-03-11 10:55:46 -04: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
000b7bfd47
buildLuarocksPackage: ability to self reference extraConfig (#288253)
makes overrideAttrs for lua packages even more powerful.
As a consequence, it simplifies the implementation of buildNeovimPlugin.
2024-02-12 18:11:24 +01:00
Matthieu Coudron
089f45ce69
buildLuarocksPackage: remove rockspecDir (#288036)
it was used only once and complexifies the buildLuarocksPackage function uselessly.
because buildLuarocksPackage accepts ... args, it wont trigger eval failures but this may break out of tree packages where the build can't find the rockspec anymore. Specify the path via `knownRockspec` if that's the case.
2024-02-11 15:09:01 +01:00
Matthieu Coudron
ff5b2d7d00 lua.tests: add test for relative import
better error message as well
extracted from https://github.com/NixOS/nixpkgs/pull/273342

written by heyarne
2024-02-06 23:21:41 +01:00
Jan Tojnar
80020c7db4 Merge branch 'master' into staging-next
; Conflicts:
;	pkgs/development/lua-modules/generated-packages.nix
;	pkgs/development/lua-modules/overrides.nix
2023-12-31 02:31:32 +01:00
Sergei Trofimovich
09a5f17eec lua-wrapper: fix luaPath and luaCpath definitions
Before the change:

    $ nix-instantiate --eval --strict --expr 'with import ./. {}; with corsix-th.luaEnv; [luaPath luaCpath]'
    error:
       error: attribute 'lib' missing

After the change:

    $ nix-instantiate --eval --strict --expr 'with import ./. {}; with corsix-th.luaEnv; [luaPath luaCpath]'
    [ "/nix/store/f17ah5zjri1yjacc1c50g9xlr8qqwbgh-lua-5.2.4-env/share/lua/5.2/?.lua;/nix/store/f17ah5zjri1yjacc1c50g9xlr8qqwbgh-lua-5.2.4-env/share/lua/5.2/?/init.lua" "/nix/store/f17ah5zjri1yjacc1c50g9xlr8qqwbgh-lua-5.2.4-env/lib/lua/5.2/?.so" ]
2023-12-30 22:37:06 +01:00
github-actions[bot]
93bd5ac278
Merge staging-next into staging 2023-12-15 18:01:36 +00:00
Adam Joseph
80472e3754 treewide: add __attrsFailEvaluation and __recurseIntoDerivationForReleaseJobs 2023-12-15 05:13:46 -08:00
Vladimír Čunát
f5eed8de6a
Merge #224295: lua: split manual into separate output
...into staging
2023-12-13 10:41:30 +01:00
Matthieu Coudron
e03c9c3f1b
buildLuarocksPackage: save luarocks config as derivation (#269402)
* buildLuarocksPackage: save luarocks config as derivation

while debugging luarocks packages, it's exhausting to have to build
them, look at what random folder they've been built to finally look for
their config.


With this you can run
    nix build lua51Packages.plenary-nvim.configFile -f . 

and infer what luarocks will do.

* Update pkgs/development/interpreters/lua-5/build-luarocks-package.nix

Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>

---------

Co-authored-by: Marc Jakobi <mrcjkb89@outlook.com>
2023-11-24 00:08:45 +01:00
Matthieu Coudron
79245fc3e7
lua: use finalAttrs for interpreters (#264381) 2023-11-23 10:19:14 +01:00
Matthieu Coudron
64b50c6f93 luaPackages: introduce an alias mechanism
so that we can deprecate modules
2023-10-14 22:03:12 +02:00
Adam Joseph
cbc8aa437c treewide: use uncurried version of makeScopeWithSplicing 2023-08-14 02:51:10 +03:00
Silvan Mosberger
a0b8caf3bc
Revert "lib.customisation: uncurry makeScopeWithSplicing" 2023-07-28 23:04:09 +02:00
Artturin
3716ef19d8 lib.makeScopeWithSplicing: provide default for keep,extra
These are often unneeded by the user.
2023-07-28 17:41:01 +03:00
Adam Joseph
cb13669b00 lib.customisation: uncurry makeScopeWithSplicing
Deeply-curried functions are pretty error-prone in untyped languages
like Nix.  This is a particularly bad case because
`top-level/splice.nix` *also* declares a makeScopeWithSplicing, but
it takes *two fewer arguments*.

Let's switch to attrset-passing form, to provide some minimal level
of sanity-checking.
2023-07-27 21:31:59 -07:00
Matthieu Coudron
34b3a809ef buildLuarocksPackage: rename file to match its role 2023-07-10 10:34:34 +02:00
Felix Buehler
6672dde558 treewide: use optionalAttrs instead of 'else {}' 2023-06-25 11:01:34 -03:00
Dmitry Bogatov
496a143d84
Update pkgs/development/interpreters/lua-5/interpreter.nix
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
2023-06-06 11:27:43 +00:00
Weijia Wang
c5f569a09a lua5_4: 5.4.4 -> 5.4.6 2023-05-26 09:19:41 +03:00
Adam Joseph
d128d47318 buildLuaPackage: fix cross
buildLuaPackage accesses lua.pkgs.luarocks, which became unspliced
at some point.  Let's use callPackage to get it, so we can be sure
it will be spliced.
2023-05-09 14:15:07 -07:00
Sandro
cac19e0266
trivial-builders: move into the directory named alike (#223429)
While searching for something different I wondered why there is a
trivial-builders.nix file next to the trivial-builders directory where
only tests live. Lets fix that.
2023-05-06 00:16:26 +02:00
Matthieu Coudron
26dd4a84ed buildLuarocksPackage: fixes attributes being ignored
follow up of https://github.com/NixOS/nixpkgs/pull/224553 where
some arguments got ignored whil they were before taken into account.
2023-04-27 22:22:01 +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
Anderson Torres
ae21df36c5 build-lua-package.nix: change self to finalAttrs 2023-04-20 22:22:23 -03:00
Dmitry Bogatov
c0bc18bf2f lua: split manual into separate output
Also, make sure that "doc" outputs of different versions of lua are
co-installable, so user can install multiple manuals and read them
side-by-side.
2023-04-01 20:31:59 -04:00
Vladimír Čunát
8bb1d31ab5
Merge #223349: lua*Packages: fix the default namePrefix
...into staging
2023-03-29 08:09:34 +02:00
Florian Klink
9218f1a00c Revert "buildLuaPackage: throw instead of marking as broken package"
This reverts commit 0cd595cdb3.

It's causing build failures for knot-resolver and others.

Workaround for https://github.com/NixOS/nixpkgs/issues/223437
2023-03-27 22:12:59 +02:00
Vladimír Čunát
a77bce6c1a
lua*Packages: fix the default namePrefix as intended 2023-03-27 09:05:25 +02:00
Matthieu Coudron
0cd595cdb3 buildLuaPackage: throw instead of marking as broken package
hopefully makes the output of nixpkgs-review more sensible.

Lua package sets are different and it makes more sense than for other
languages for packages to not be supported in specific package sets.
2023-03-26 01:45:24 +01:00
LeixB
59a4dd8678
lua-rocks-move-data: fix missing doc tags on luaPackages neovim plugins
fixes #220199

This makes `luarocksMoveDataHook` run before `vimPluginGenTags` since it
is added first to `preFixupHooks`.
2023-03-10 13:12:32 +01:00
Luna Nova
02fa99fd08 lua_5_3_compat, lua_5_4_compat: set LUA_COMPAT_5_x as LUA_COMPAT_ALL was removed
Fixes NixOS#218227
2023-02-28 01:56:06 +01:00
Artturin
4e3dcf364e treewide: makeSetupHook deps -> propagatedBuildInputs 2023-02-07 21:02:00 +02:00
Artturin
9a9c42e19f makeSetupHook: support depsTargetTargetPropagated 2023-02-07 21:00:18 +02:00
Guillaume Girol
90c78aee6c Merge branch 'nativeCheckInputs' into staging-nativeCheckInputs 2023-01-21 12:00:00 +00:00
Guillaume Girol
b7042dc36a buildLuaPackage: adapt to native check inputs 2023-01-21 16:42:10 +01:00
Alyssa Ross
0ae87d514f treewide: add names to all setup hooks 2023-01-19 15:00:36 +00:00