Commit Graph

24 Commits

Author SHA1 Message Date
Doron Behar
7b9e4c7595 buildLuarocksPackage: fix cross compilation wrapping
- Make `lua` gain `luaOnBuildFor{Build,Host,Target}` and alike attributes.
- wrapLua: correctly substitute build & host lua & luarocks_bootstrap
- Disallow build platform references when using `buildLuarocksPackage`
  in cross building.
2026-03-09 18:39:19 +02:00
Michael Daniels
4b7d598de4 Reapply "Merge branch 'staging-next' into staging"
This reverts commit 4982f4c206.

The eval failure was not introduced by my merge!
2026-02-27 19:47:50 -05:00
Michael Daniels
4982f4c206 Revert "Merge branch 'staging-next' into staging"
This reverts commit c00451dc71, reversing
changes made to 71467300b6.
2026-02-27 19:35:48 -05:00
Austin Horstman
6a76136306 build-luarocks-package: include nativeBuildInputs
Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2026-02-27 09:49:14 -06:00
nixpkgs-ci[bot]
7673a2fb77 Merge staging-next into staging 2026-01-26 00:20:52 +00:00
Matthieu Coudron
ca520f49c3 bustedCheckHook: init (#481930) 2026-01-24 19:56:03 +00:00
teto
3485f095ad bustedCheckHook: init and convert luaPackages to use it
- add bustedCheckHook in the nativeCheckInputs and busted will run when
  doCheck is enabled. You can customize its call via "bustedFlags" and
  prevent it from running with "dontBustedCheck". If "nlua" is
  available, busted will automatically run busted with nlua as
  interpreter (already done in lux). Goal is to standardize the writing
  of tests so that if feels less like copy & paste.
- removed the default checkPhase from buildLuarocksPackage which was
  running "luarocks test". None of the plugins was using as far as I
  know  because no plugin out there (maybe 2 or 3) uses that ? it could
  be considered a breaking change but in practice I dont think it is.
2026-01-23 17:32:33 +01:00
Artturin
e1e2f27c78 luaPackages.buildLuarocksPackage: Get the final derivation picked by
mkDerivation instead of using the raw list

```
   … while evaluating attribute 'propagatedBuildInputs' of derivation 'wrap-lua-hook'
     at /home/art/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:600:13:
      599|             depsHostHostPropagated = elemAt (elemAt propagatedDependencies 1) 0;
      600|             propagatedBuildInputs = elemAt (elemAt propagatedDependencies 1) 1;
         |             ^
      601|             depsTargetTargetPropagated = elemAt (elemAt propagatedDependencies 2) 0;
   … while calling the 'getAttr' builtin
     at «nix-internal»/derivation-internal.nix:50:17:
       49|     value = commonAttrs // {
       50|       outPath = builtins.getAttr outputName strict;
         |                 ^
       51|       drvPath = strict.drvPath;
   … while calling the 'derivationStrict' builtin
     at «nix-internal»/derivation-internal.nix:37:12:
       36|
       37|   strict = derivationStrict drvAttrs;
         |            ^
       38|
   … while evaluating derivation 'make-shell-wrapper-hook'
     whose name attribute is located at /home/art/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:541:13
   … while evaluating attribute 'shell' of derivation 'make-shell-wrapper-hook'
     at /home/art/nixgits/my-nixpkgs/pkgs/top-level/all-packages.nix:716:7:
      715|       # targetPackages.runtimeShell only exists when pkgs == targetPackages (when targetPackages is not  __raw)
      716|       shell =
         |       ^
      717|         if targetPackages ? runtimeShell then
   … while calling the 'throw' builtin
     at /home/art/nixgits/my-nixpkgs/pkgs/top-level/all-packages.nix:720:11:
      719|         else
      720|           throw "makeWrapper/makeShellWrapper must be in nativeBuildInputs";
         |           ^
      721|     };
   error: makeWrapper/makeShellWrapper must be in nativeBuildInputs
```
2026-01-20 15:20:05 +02:00
teto
b81acec358 buildLuarocksPackage: enable strictDeps by default
disabled strictDeps for derivations that fail until we fix them.
This change helps with new packages.
2026-01-12 00:13:48 +01:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01: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 C.
e511f674e1 luarocks: use self.pname for an effective overrideAttrs
luarocks-nix store path was ..luarocks-version instead of ...luarocks-nix-version. This fixes it
2024-06-24 23:06:30 +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
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
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
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
34b3a809ef buildLuarocksPackage: rename file to match its role 2023-07-10 10:34:34 +02:00