Skip to content

luaPackages.wrapLua: Fix the wrapper on cross#481464

Merged
Artturin merged 2 commits intoNixOS:masterfrom
Artturin:luacross
Jan 25, 2026
Merged

luaPackages.wrapLua: Fix the wrapper on cross#481464
Artturin merged 2 commits intoNixOS:masterfrom
Artturin:luacross

Conversation

@Artturin
Copy link
Member

@Artturin Artturin commented Jan 18, 2026

The wrapper was using a makeWrapper targeting the buildPlatform

This is a leftover from a fix I did before I converted luaPackages to use makeScopeWithSplicing

Fixes: #481454

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

The wrapper was using a makeWrapper targeting the buildPlatform

This is a leftover from a fix I did before I converted luaPackages to
use makeScopeWithSplicing

Fixes: https://www.github.com/NixOS/nixpkgs/issues/481454
@doronbehar
Copy link
Contributor

Fails to evaluate pkgsCross.armv7l-hf-multiplatform.lua5_4.pkgs.cjson:

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'lua5.4-lua-cjson-2.1.0.10-1-armv7l-unknown-linux-gnueabihf'
         whose name attribute is located at /home/doron/repos/nixpkgs/pkgs/stdenv/generic/make-derivation.nix:541:13

       … while evaluating attribute 'LUAROCKS_CONFIG' of derivation 'lua5.4-lua-cjson-2.1.0.10-1-armv7l-unknown-linux-gnueabihf'

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: makeWrapper/makeShellWrapper must be in nativeBuildInputs

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. labels Jan 18, 2026
@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label Jan 19, 2026
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
```
@@ -142,7 +142,7 @@ let
luarocksConfig =
let
externalDepsGenerated = lib.filter (drv: !drv ? luaModule) (
self.nativeBuildInputs ++ self.propagatedBuildInputs ++ self.buildInputs
self.finalPackage.nativeBuildInputs ++ self.propagatedBuildInputs ++ self.buildInputs
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't made with cross in mind so dunno if the buildHost should be picked or the hostTarget
If the hostTarget should be picked then the list has to be mapped and x.__spliced.hostTarget picked

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was added here 011911b

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't made with cross in mind so dunno if the buildHost should be picked or the hostTarget If the hostTarget should be picked then the list has to be mapped and x.__spliced.hostTarget picked

I think this works fine. The correct Bash is used in the wrappers of:

nix build -Lf. pkgsCross.armv7l-hf-multiplatform.lua54Packages.cjson

However still the 2 other commits available in #481511 are needed.

@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Jan 20, 2026
@nixpkgs-ci nixpkgs-ci bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jan 20, 2026
@doronbehar doronbehar requested a review from teto January 25, 2026 19:41
Copy link
Member

@teto teto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know nothing about cross, I leave it for smarter people who actually need it. As long as nixpkgs-review passes and it doesnt break my workflow, do however you see fit, you've both got merging right :) Seems legit.

@nixpkgs-ci nixpkgs-ci bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Jan 25, 2026
@doronbehar doronbehar marked this pull request as ready for review January 25, 2026 20:17
@doronbehar
Copy link
Contributor

I'm running now a nixpkgs-review on x86_64-linux to learn about the peculiar amount of rebuilds (less then in #481511 and more then 10).

@doronbehar
Copy link
Contributor

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 481464
Commit: e1e2f27c78a0b117726780ccb5eda09f88868328


x86_64-linux

❌ 8 packages failed to build:
  • luajitPackages.rocks-config-nvim
  • luajitPackages.rocks-dev-nvim
  • luajitPackages.rocks-git-nvim
  • luajitPackages.rocks-nvim
  • vimPlugins.rocks-config-nvim
  • vimPlugins.rocks-dev-nvim
  • vimPlugins.rocks-git-nvim
  • vimPlugins.rocks-nvim
✅ 116 packages built:
  • lua51Packages.argparse
  • lua51Packages.cyan
  • lua51Packages.fzy
  • lua51Packages.grug-far-nvim
  • lua51Packages.haskell-tools-nvim
  • lua51Packages.llscheck
  • lua51Packages.luacheck
  • lua51Packages.lualine-nvim
  • lua51Packages.luaprompt
  • lua51Packages.lz-n
  • lua51Packages.lze
  • lua51Packages.lzextras
  • lua51Packages.lzn-auto-require
  • lua51Packages.moonscript
  • lua51Packages.neorg
  • lua51Packages.neorg-interim-ls
  • lua51Packages.neotest
  • lua51Packages.nvim-nio
  • lua51Packages.papis-nvim
  • lua51Packages.pathlib-nvim
  • lua51Packages.rest-nvim
  • lua51Packages.rocks-config-nvim
  • lua51Packages.rocks-dev-nvim
  • lua51Packages.rocks-git-nvim
  • lua51Packages.rocks-nvim
  • lua51Packages.rtp-nvim
  • lua51Packages.rustaceanvim
  • lua51Packages.sofa
  • lua51Packages.sqlite
  • lua51Packages.teal-language-server
  • lua51Packages.tl
  • luaPackages.argparse (lua52Packages.argparse)
  • luaPackages.cyan (lua52Packages.cyan)
  • luaPackages.fzy (lua52Packages.fzy)
  • luaPackages.llscheck (lua52Packages.llscheck)
  • luaPackages.luacheck (lua52Packages.luacheck)
  • luaPackages.luaprompt (lua52Packages.luaprompt)
  • luaPackages.moonscript (lua52Packages.moonscript)
  • luaPackages.neotest (lua52Packages.neotest)
  • luaPackages.papis-nvim (lua52Packages.papis-nvim)
  • luaPackages.sofa (lua52Packages.sofa)
  • luaPackages.sqlite (lua52Packages.sqlite)
  • luaPackages.teal-language-server (lua52Packages.teal-language-server)
  • luaPackages.tl (lua52Packages.tl)
  • lua53Packages.argparse
  • lua53Packages.cyan
  • lua53Packages.fzy
  • lua53Packages.llscheck
  • lua53Packages.luacheck
  • lua53Packages.luaprompt
  • lua53Packages.moonscript
  • lua53Packages.neotest
  • lua53Packages.papis-nvim
  • lua53Packages.sofa
  • lua53Packages.sqlite
  • lua53Packages.teal-language-server
  • lua53Packages.tl
  • lua54Packages.argparse
  • lua54Packages.cyan
  • lua54Packages.fzy
  • lua54Packages.llscheck
  • lua54Packages.luacheck
  • lua54Packages.luaprompt
  • lua54Packages.moonscript
  • lua54Packages.sofa
  • lua54Packages.teal-language-server
  • lua54Packages.tl
  • luajitPackages.argparse
  • luajitPackages.cyan
  • luajitPackages.fzy
  • luajitPackages.grug-far-nvim
  • luajitPackages.haskell-tools-nvim
  • luajitPackages.llscheck
  • luajitPackages.luacheck
  • luajitPackages.lualine-nvim
  • luajitPackages.luaprompt
  • luajitPackages.lz-n
  • luajitPackages.lze
  • luajitPackages.lzextras
  • luajitPackages.lzn-auto-require
  • luajitPackages.moonscript
  • luajitPackages.neorg
  • luajitPackages.neorg-interim-ls
  • luajitPackages.neotest
  • luajitPackages.nvim-nio
  • luajitPackages.papis-nvim
  • luajitPackages.pathlib-nvim
  • luajitPackages.rest-nvim
  • luajitPackages.rtp-nvim
  • luajitPackages.rustaceanvim
  • luajitPackages.sofa
  • luajitPackages.sqlite
  • luajitPackages.teal-language-server
  • luajitPackages.tl
  • mpvScripts.mpv-webm
  • nelua
  • sile
  • sile.dev
  • sile.doc
  • sile.man
  • tests.writers.simple.luaNoLibs
  • vimPlugins.grug-far-nvim
  • vimPlugins.haskell-tools-nvim
  • vimPlugins.lualine-nvim
  • vimPlugins.lz-n
  • vimPlugins.lze
  • vimPlugins.lzextras
  • vimPlugins.lzn-auto-require
  • vimPlugins.neorg
  • vimPlugins.neorg-interim-ls
  • vimPlugins.neotest
  • vimPlugins.nvim-nio
  • vimPlugins.papis-nvim
  • vimPlugins.rest-nvim
  • vimPlugins.rtp-nvim
  • vimPlugins.rustaceanvim

Error logs: `x86_64-linux`
luajitPackages.rocks-nvim
Error → ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua @ 66
Rocks pin/unpin pin/unpin plugin with only version
...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:48: Test task failed with message:
The coroutine failed with this message: 
spec/operations/pin_commands_spec.lua:31: Expected objects to be the same.
Passed in:
(table: 0x7ffff535e720) {
 *[1] = 'rocks.nvim' }
Expected:
(table: 0x7ffff535e8b0) { }
stack traceback:
	[C]: in function 'throw'
	...i-luajit2.1-busted-2.3.0-1/share/lua/5.1/busted/core.lua:149: in function 'error'
	...it2.1-luassert-1.9.0-1/share/lua/5.1/luassert/assert.lua:51: in function 'same'
	spec/operations/pin_commands_spec.lua:31: in function <spec/operations/pin_commands_spec.lua:26>

stack traceback:
...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:48: in function <...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:31>

E5113: Error while calling lua chunk: [NULL]

@doronbehar
Copy link
Contributor

All files in results/*/bin/* look perfectly fine to me. @Artturin if you have anything else you feel that needs to be verified, tell me.

@doronbehar
Copy link
Contributor

Oh and that luajitPackages.rocks-nvim failure seems like a false negative. It worked for me the 2nd time.

@teto
Copy link
Member

teto commented Jan 25, 2026

(while I dont mind breaking a few packages for some big/complex PRs, rocks.nvim is a neovim plugin manager, one of those root packages we dont wanna break. And this has nothing to do with me using it ;) )

@Artturin
Copy link
Member Author

Artturin commented Jan 25, 2026

@doronbehar
Copy link
Contributor

As I said, that failure was a false negative.

@Artturin Artturin added this pull request to the merge queue Jan 25, 2026
Merged via the queue into NixOS:master with commit 4054ea2 Jan 25, 2026
37 of 39 checks passed
@Artturin Artturin deleted the luacross branch January 25, 2026 21:25
@teto
Copy link
Member

teto commented Jan 25, 2026

funnily enough I just had a rocks.nvim failure when rebuilding that disappeared on second attempt.

Do you remember if this was similiar to :

       > Running phase: buildPhase
       > Running phase: checkPhase
       > ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●✱
       > 30 successes / 0 failures / 1 error / 0 pending : 0.429583 seconds
       >
       > Error → ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua @ 66
       > Rocks pin/unpin pin/unpin plugin with only version
       > ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:48: Test task failed with message:
       > The coroutine failed with this message:
       > spec/operations/pin_commands_spec.lua:31: Expected objects to be the same.
       > Passed in:
       > (table: 0x7ffff52fddb8) {
       >  *[1] = 'rocks.nvim' }
       > Expected:
       > (table: 0x7ffff52fdf48) { }
       > stack traceback:
       >       [C]: in function 'throw'
       >        ...6-luajit2.1-busted-2.3.0-1/share/lua/5.1/busted/core.lua:149: in function 'error'
       >    ...it2.1-luassert-1.9.0-1/share/lua/5.1/luassert/assert.lua:51: in function 'same'
       >      spec/operations/pin_commands_spec.lua:31: in function <spec/operations/pin_commands_spec.lua:26>
       >
       > stack traceback:
       >       ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:48: in function <...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:31>
       >
       > E5113: Error while calling lua chunk: [NULL]

cc @mrcjkb

@doronbehar
Copy link
Contributor

Do you remember if this was similiar to :

It was. See the logs in nixpkgs-review previous comment.

@mrcjkb
Copy link
Member

mrcjkb commented Jan 26, 2026

funnily enough I just had a rocks.nvim failure when rebuilding that disappeared on second attempt.

Do you remember if this was similiar to :

       > Running phase: buildPhase
       > Running phase: checkPhase
       > ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●✱
       > 30 successes / 0 failures / 1 error / 0 pending : 0.429583 seconds
       >
       > Error → ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua @ 66
       > Rocks pin/unpin pin/unpin plugin with only version
       > ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:48: Test task failed with message:
       > The coroutine failed with this message:
       > spec/operations/pin_commands_spec.lua:31: Expected objects to be the same.
       > Passed in:
       > (table: 0x7ffff52fddb8) {
       >  *[1] = 'rocks.nvim' }
       > Expected:
       > (table: 0x7ffff52fdf48) { }
       > stack traceback:
       >       [C]: in function 'throw'
       >        ...6-luajit2.1-busted-2.3.0-1/share/lua/5.1/busted/core.lua:149: in function 'error'
       >    ...it2.1-luassert-1.9.0-1/share/lua/5.1/luassert/assert.lua:51: in function 'same'
       >      spec/operations/pin_commands_spec.lua:31: in function <spec/operations/pin_commands_spec.lua:26>
       >
       > stack traceback:
       >       ...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:48: in function <...-luajit2.1-nvim-nio-1.10.1-1/share/lua/5.1/nio/tests.lua:31>
       >
       > E5113: Error while calling lua chunk: [NULL]

cc @mrcjkb

Hmm, looks like it could be a flaky test.
I'll look into it...

Edit: lumen-oss/rocks.nvim@0a194de

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: lua Lua is a powerful, efficient, lightweight, embeddable scripting language. 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 101-500 This PR causes between 101 and 500 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

luaPackages are not spliced correctly

4 participants