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

Sync Flake with nix derivation changes for easier extension of available Lua modules #2186

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

alerque
Copy link
Member

@alerque alerque commented Dec 1, 2024

Hey @doronbehar, my attempt to port the upstream packaging changes to the sile derivation to the flake here did not go quite as planned. It builds and runs, but it doesn't work as it should as evidenced by the fact that I can delete stuff in the luaPackages array and the build doesn't fail the configure stage where it should be detecting dependencies. That tells me the upstream package one is being used, not the locally defined one. I couldn't figue our the Nix language incantation to override the array in the passthru table and use it in the luaEnv at the same time.

@alerque alerque added this to the v0.15.8 milestone Dec 1, 2024
@alerque alerque added the tooling Build tooling, release management, and packaging processes label Dec 1, 2024
@alerque alerque self-assigned this Dec 1, 2024
@doronbehar
Copy link
Contributor

I ran:

nix eval --json .\#sile-luajit.buildInputs | jq --raw-output '.[]' | grep -- '-env'

On the nix-sync branch, and got:

/nix/store/8w44qpgqn7f3aa4plyfnzngn4rzsr0qw-luajit-2.1.1713773202-env

Then I applied:

diff --git i/build-aux/pkg.nix w/build-aux/pkg.nix
index 5d774f8e..79ae2d11 100644
--- i/build-aux/pkg.nix
+++ w/build-aux/pkg.nix
@@ -136,7 +136,6 @@ stdenv.mkDerivation (finalAttrs: {
     luaPackages =
       [
         # modules used at runtime
-        "cassowary"
         "cldr"
         "fluent"
         "linenoise"

And got a different hash:

/nix/store/0xc26lxpqgxwfndd2z3j4igplsmq14c8-luajit-2.1.1713773202-env

@alerque
Copy link
Member Author

alerque commented Dec 2, 2024

The eval is clearly different, but the problem is that the build succeeds either way. It should have failed completely when you removed cassowary as the configure phase should have determined that it was missing.

@alerque
Copy link
Member Author

alerque commented Dec 2, 2024

Ah garumph. The flake builds either way but crashes at runtime instead. I hadn't tried that yet, so apparently the change is affecting the build, but something is wrong with the configure phase that should have thrown an error when it couldn't find the dependency.

@doronbehar
Copy link
Contributor

I see in the configurePhase output:

sile> checking whether LuaRock cassowary is installed... no
sile> checking whether Lua can load module cassowary... unable to load
sile> checking whether LuaRock compat53 is installed... no
sile> checking whether Lua can load module compat53... loaded
sile> checking whether LuaRock cldr is installed... no
sile> checking whether Lua can load module cldr... unable to load
sile> checking whether LuaRock fluent is installed... no
sile> checking whether Lua can load module fluent... unable to load
sile> checking whether LuaRock linenoise is installed... no
sile> checking whether Lua can load module linenoise... unable to load
sile> checking whether LuaRock loadkit is installed... no
sile> checking whether Lua can load module loadkit... loaded
sile> checking whether LuaRock lpeg is installed... no
sile> checking whether Lua can load module lpeg... loaded
sile> checking whether LuaRock lua-zlib is installed... no
sile> checking whether Lua can load module zlib... loaded
sile> checking whether LuaRock lua_cliargs is installed... no
sile> checking whether Lua can load module cliargs... loaded
sile> checking whether LuaRock luaepnf is installed... no
sile> checking whether Lua can load module epnf... loaded
sile> checking whether LuaRock luaexpat is installed... no
sile> checking whether Lua can load module lxp... loaded
sile> checking whether LuaRock luafilesystem is installed... no
sile> checking whether Lua can load module lfs... loaded
sile> checking whether LuaRock luarepl is installed... no
sile> checking whether Lua can load module repl... loaded
sile> checking whether LuaRock luasec is installed... no
sile> checking whether Lua can load module ssl... loaded
sile> checking whether LuaRock luasocket is installed... no
sile> checking whether Lua can load module socket... loaded
sile> checking whether LuaRock luautf8 is installed... no
sile> checking whether Lua can load module lua-utf8... loaded
sile> checking whether LuaRock penlight is installed... no
sile> checking whether Lua can load module pl... loaded
sile> checking whether LuaRock vstruct is installed... no
sile> checking whether Lua can load module vstruct... loaded

@doronbehar
Copy link
Contributor

I also see:

sile> Makefile.am:70: error: 'rusile.so' is not a standard library name
sile> Makefile.am:70: did you mean 'librusile.a'?

Which maybe related to NixOS/nixpkgs#361005 .

@doronbehar
Copy link
Contributor

And the build succeeds, but running the executable fails to find the modules I removed.

@alerque
Copy link
Member Author

alerque commented Dec 2, 2024

Yes, I got that too (per my message above you might have missed, being busy composing one yourself). I just identified why I didn't figure that out sooner: at runtime it finds the cassowary installation from my host system when it can't find it in the flake. As SILE is designed for users/projects to add or override their own dependencies at runtime that is expected, it just made debugging this hard.

That doesn't explain why it succeeds to build when it should not, but I'll look into that more.

@alerque
Copy link
Member Author

alerque commented Dec 2, 2024

Your output is also suggesting that the LuaRocks manifests are not getting installed properly via nix. I suspect luarocks list is going to show nothing even when various Lua rocks are provided by Nix packages. This is probably a general ecosystem wide problem with Lua in Nix.

@alerque
Copy link
Member Author

alerque commented Dec 2, 2024

Sooo, that turned out to be a bug in my autoconf macro code, not the Flake at all.

@alerque alerque marked this pull request as ready for review December 2, 2024 21:37
@alerque alerque merged commit 154f441 into sile-typesetter:master Dec 2, 2024
21 checks passed
@alerque alerque deleted the nix-sync branch December 2, 2024 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Build tooling, release management, and packaging processes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants