Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua: convert some more packages #55747

Closed
wants to merge 9 commits into from
Closed

Conversation

teto
Copy link
Member

@teto teto commented Feb 14, 2019

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@teto
Copy link
Member Author

teto commented Feb 14, 2019

I would like to run a nix-review on it before merging, but I have some problems with it so don't merge yet.

@teto
Copy link
Member Author

teto commented Feb 14, 2019

nix-review shows some errors which is strange since building just lua-zlib works fine.

Maybe zlib is not properly propagated and I should set ZLIB_DIR

  Error: Could not find header file for ZLIB
    No file zlib.h in /nix/store/vj3hlhyh30bmc2n84v3zn9hj320ahvf4-lua-5.2.4/include
  You may have to install ZLIB in your system and/or pass ZLIB_DIR or ZLIB_INCDIR to the luarocks command.
  Example: luarocks install lua-zlib ZLIB_DIR=/usr/local
note: keeping build directory '/tmp/nix-build-lua5.3-lua-zlib-1.2-0.drv-1'
builder for '/nix/store/f0n39nj50wc801ry9jcpcr0n1aldzgqd-lua5.3-lua-zlib-1.2-0.drv' failed with exit code 1; last 10 log lines:
  configuring
  building
  patching script interpreter paths in .
  installing
  Warning: The directory '' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing /nix/store/kqnggi6xw7wma3pc9hybkpgrbq27hsma-luarocks-2.4.4/bin/.luarocks-wrapped with sudo, you may want sudo's -H flag.
  
  Error: Could not find header file for ZLIB
    No file zlib.h in /nix/store/vj3hlhyh30bmc2n84v3zn9hj320ahvf4-lua-5.2.4/include
  You may have to install ZLIB in your system and/or pass ZLIB_DIR or ZLIB_INCDIR to the luarocks command.
  Example: luarocks install lua-zlib ZLIB_DIR=/usr/local
cannot build derivation '/nix/store/rw447zf7f3fshcgd5lsis906ymkf40yg-sile-0.9.5.1.drv': 1 dependencies couldn't be built
note: keeping build directory '/tmp/nix-build-luakit-2017.08.10.drv-0'
builder for '/nix/store/fc56mv5c9sdg0lb49ccccz9jy0y0c5rf-luakit-2017.08.10.drv' failed with exit code 2; last 10 log lines:
  	no file '/usr/local/lib/lua/5.1/lfs.so'
  	no file '/nix/store/jqyzldswfipxhfa19hlxpp6yx48f4961-luajit-2.1.0-beta3/lib/lua/5.1/lfs.so'
  	no file '/usr/local/lib/lua/5.1/loadall.so'
  stack traceback:
  	[C]: in function 'require'
  	build-utils/docgen/gen.lua:1: in main chunk
  	[C]: in function 'require'
  	./build-utils/docgen/makedoc.lua:9: in main chunk
  	[C]: at 0x00405500
  make: *** [Makefile:81: doc/apidocs/index.html] Error 1
cannot build derivation '/nix/store/s5lmrily8m70526092gdfrpac4z3i66g-env.drv': 6 dependencies couldn't be built
[27 built (5 failed), 262 copied (706.6 MiB), 162.8 MiB DL]
error: build of '/nix/store/s5lmrily8m70526092gdfrpac4z3i66g-env.drv' failed
6 package failed to build:
lua51Packages.luazlib lua52Packages.luazlib lua53Packages.luazlib luajitPackages.luazlib luakit sile

24 package were build:
lua51Packages.busted lua51Packages.lua-zlib lua51Packages.luacheck lua51Packages.luaexpat lua51Packages.luafilesystem lua51Packages.penlight lua52Packages.busted lua52Packages.lua-zlib lua52Packages.luacheck lua5_expat lua52Packages.luafilesystem lua52Packages.penlight lua53Packages.busted lua53Packages.lua-zlib lua53Packages.luacheck lua53Packages.luafilesystem lua53Packages.penlight luajitPackages.busted luajitPackages.lua-zlib luajitPackages.luacheck luajitPackages.luafilesystem luajitPackages.penlight prosody wordgrinder

but if I run NIX_PATH="nixpkgs=/home/teto/nixpkgs2:$NIX_PATH" nix-shell -p 'lua5_3.withPackages(p: [ p.lua-zlib] )' it is built ok.

sile could also be updated to use lua env as I did in https://github.com/teto/nixpkgs/tree/lua_envs

@teto
Copy link
Member Author

teto commented Feb 18, 2019

for some reason lfs.so (luafilesystem) isn't brought in the luakit environment... will check when I have more time.

@teto
Copy link
Member Author

teto commented Feb 27, 2019

when looking into more details, it seems like several lua environments are generated via nix build luakit, one with lfs.so as expected and the other without inputs. I am not sure why, must be a bug somewhere in the lua infrastructure.

@Mic92
Copy link
Member

Mic92 commented Feb 27, 2019

Some commits that can already be cherry-picked?

@teto
Copy link
Member Author

teto commented Feb 28, 2019

@Mic92 thanks for proposing

  • add isLua53 8071a4803bbeb7297b400518e0bbea1366cbf3ec
  • lua5Packages.luuid ee78d0c
  • lua: run postConfigure hook for rock and rockspec 27de7f1 actually fixes a bug so would be top priority to merge

@Mic92
Copy link
Member

Mic92 commented Mar 7, 2019

Cherry-picked all three. Can be removed with an interactive rebase from this pr now.

@grahamc
Copy link
Member

grahamc commented Apr 12, 2019

@GrahamcOfBorg eval

the package was passing the package version of a specific lua interpreter
which made nix review fails.
(Also in the end it was just using luajit).
gcc -c extension/clib/msg.c -o extension/clib/msg.o
gcc -c extension/clib/ipc.c -o extension/clib/ipc.o
gcc -c extension/clib/luakit.c -o extension/clib/luakit.o
gcc -o luakit.so extension/luajs.o extension/ipc.o extension/extension.o extension/log.o extension/script_world.o extension/scroll.o extension/clib/page.o extension/clib/dom_document.o extension/clib/soup.o extension/clib/dom_element.o extension/clib/msg.o extension/clib/ipc.o extension/clib/luakit.o common/luajs.o common/luaobject.o common/luayield.o common/util.o common/luautil.o common/luauniq.o common/property.o common/ipc.o common/luah.o common/luaserialize.o common/resource.o common/lualib.o common/luaclass.o common/clib/timer.o common/clib/utf8.o common/clib/ipc.o common/clib/luakit.o common/clib/regex.o common/tokenize.o
rm -rf doc/apidocs
mkdir doc/apidocs
luajit ./build-utils/docgen/makedoc.lua
/nix/store/zrarsvfma3zfc00dg99lfq3s0p163yv9-luajit-2.1.0-beta3/bin/luajit: build-utils/docgen/gen.lua:2: module 'lib.lousy.util' not found:
        no field package.preload['lib.lousy.util']
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/lib/lua/5.1/lib/lousy/util.lua'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/share/lua/5.1/lib/lousy/util.lua'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/share/lua/5.1/lib/lousy/util/init.lua'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/lib/lua/5.1/lib/lousy/util/init.lua'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/share/luajit-2.1.0-beta3/lib/lousy/util.lua'
        no file 'build-utils/lib/lousy/util.lua'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/lib/lua/5.1/lib/lousy/util.so'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/share/lua/5.1/lib/lousy/util.so'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/lib/lua/5.1/lib.so'
        no file '/nix/store/xa7a51dw6hvx0r4ka65blxha5660akn9-luajit-2.1.0-beta3-env/share/lua/5.1/lib.so'
stack traceback:
        [C]: in function 'require'
        build-utils/docgen/gen.lua:2: in main chunk
        [C]: in function 'require'
        ./build-utils/docgen/makedoc.lua:9: in main chunk
        [C]: at 0x00406330
make: *** [Makefile:85: doc/apidocs/index.html] Error 1
note: keeping build directory '/tmp/nix-build-luakit-2.1.drv-1'
builder for '/nix/store/dzsw6a59vsz5s2h0zipa1805qk2ny6qi-luakit-2.1.drv' failed with exit code 2
error: build of '/nix/store/dzsw6a59vsz5s2h0zipa1805qk2ny6qi-luakit-2.1.drv' failed
@teto
Copy link
Member Author

teto commented Jun 14, 2019

closed in favor of #63108

@teto teto closed this Jun 14, 2019
@teto teto deleted the lua_whitelist_dangerous branch May 13, 2020 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants