Hacker Newsnew | past | comments | ask | show | jobs | submit | mrcjkb's commentslogin

You mean my Hakyll site? It's mot meant to be :)


Lua has evolved and is used for a lot more today than it was initially created for.


You might be surprised how well that works :)


One of the motivations for Lux is to improve the nixpkgs Lua and Neovim ecosystems.


That sounds like a great idea! I've opened [an issue](https://github.com/nvim-neorocks/lux/issues/550) in our repo. Feel free to ping us there :)


Yes, we have a `lux-lua` library (which we will need to bundle with `lux-cli`) that exposes a `lux.loader` module. It uses the lockfile to resolve dependencies.


With Lua, it becomes near impossible for a program like lux to edit the manifest.

For example, how would I `lx add <dependency@version>` if the `dependencies` table might be generated by a Lua function?

Lux defaults to TOML, but if you really want Lua, it also supports an `extra.rockspec` in the project root, which shares the same format as the luarocks RockSpec format.


The function would be "compile time" so that function would be evaluated when you call `lx add <dependency@version>`, I'd also assume that the previous configuration would be cached and a diff shown of dependencies.

But I would also accept that it would be a subset of Lua that could define tables, but not contain functions. The data only declarative sublanguage.


We want to be able to write updated dependency specs to the manifest.


- There's an equivalent `lx path bin` command, but there's also a `lx run` that lets you run installed packages.

- We're still quite early on in development, so documentation and things like error messages will need fleshing out.

- We don't have luvit integration yet

- Yes, it also works with LuaJIT, either via pkg-config or by installing LuaJIT headers using the `luajit_src` crate.


> - Yes, it also works with LuaJIT, either via pkg-config or by installing LuaJIT headers using the `luajit_src` crate.

Are there any documentation on this?

luarocks works with luajit after I run that specific command, I expect something like that as it is very easy, so I wonder if running "lx path bin" would work.


Only the `lx --help` and man pages.


I will take a look when I get into Lua again. :)


That's a neat suggestion, thanks. Lux will need some time to become mature, but building a large multi-platform project like koreader would definitely be a nice goal.


With Lua, it becomes near impossible for a program like lux to edit the manifest.

For example, how would I `lx add <dependency@version>` if the `dependencies` table might be generated by a Lua function?


Indeed. I'm glad for us to have learned Python's 20 year lesson on the dangers of an executable manifest.


The Zig language seems to have learned the lesson the other way though: https://ziglang.org/learn/build-system/


Isn't build.zig.zon the equivalent of the manifest in that case though?


Sure, but a zon file is really just an anonymous zig struct.


With the disclaimer that I know nothing about zig, I will say that Nix's flake files follow an interesting pattern where the output section is evaluated under the regular Nix interpreter and can do anything, whereas the input section is evaluated under a far stricter mini-interpreter that prohibits everything other than basic strings and attrsets (dictionaries).

A flake.nix is certainly not packaging metadata, but I do know those input section restrictions do cause occasional confusion with users who think "ah, Nix code" and only realise afterward that it's really json in Nix syntax."

All that to say, if a thing is not evaluate-able, it's probably best to represent it in a different enough form that no one could mistake it for a thing that can be evaluated.


Why not use a function to add dependencies, e.g. `add_dependency "dependency@version"` or `add_dependencies { ...table-here... }`. This is, more or less, how premake works [1]. For `lx add ...` you'd append the function call to the script.

[1] https://premake.github.io/docs/Your-First-Script


That doesn't seem very ergonomic - especially for the use cases we have in mind.


Load the table. Modify. Serialize to file.

Not too hard. Emacs does it with the .emacs file, mixing generated and manual content.


> Load the table

If it comes from an impure function, you don't know if you'll get the same result each time you evaluate it.

> Modify. Serialize to file.

And potentially lose information.


Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: