-
-
Notifications
You must be signed in to change notification settings - Fork 14k
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
Automatically generate LUA_PATH #29957
Comments
Missing a backtick in your text. 😉 |
I think that you need to make it so that every lua package has a |
@FRidh you have done sthg similar with julia package/python. I am interested in your opinion; I've read https://gist.github.com/FRidh/c3e974e34eac738405af699786b462d5#current-implementation-of-python-on-nix and I am still not sure what's the point in building an environment ? I wonder if the python packages are found via the "pythonpath" variable in buildInputs ? there is a comment in mk-python-package |
Again, for reference, very closely related to: #25830 |
thanks for the link, I had seen this but it said it didn't work. I will try
a similar approach and maybe if environments are helpful I can add them
afterwards.
2017-10-01 21:50 GMT+09:00 Vladimír Čunát <notifications@github.com>:
… Again, for reference, very closely related to: #25830
<#25830>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#29957 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA2FOvOdbIfXTwXHjBttp1vVT4JfU5-jks5sn4qxgaJpZM4Ppltr>
.
|
arf I can't make anything work reliably. An envHook works on the native dependencies (nativeBuildInputs + propagatedNativeBuildInputs) as shown in stdenv/generic/setup.sh
but it is not run on the package itself; in situations where I run I don't get how but doing
When I do
Reading through man nix-shell, -p creates an environment so I suppose python does sthg special when nix-shell creates its environment while lua doesn't ? |
Certainly it doesn't, because |
nix-repl tells me that lua is in lua52Packages.cjson.propagatedNativeBuildInputs yet when I do |
propagatedNativeBuildInputs is empty in the shell while. Doesn't a change in the lua52Packages.cjson derivation trigger a rebuild even if linked via |
@teto May you commit |
true I moved it to a specific file in order to more quickly find it in vim. |
I suggest not using a hook and instead create a LUA_PATH with Nix. You could add a certain attribute to Lua packages so they can be recognized as Lua packages. |
@FRidh How do we make |
The following is needed:
For 1) typically a I think its better to create a |
I've taken the withPackages approach and it seems to work. I will push a clean PR when I feel more confident. What I still don't understand (and this explains why I missed it) is python's wrapper.nix: |
@teto a perhaps clearer example is provided in https://github.com/NixOS/nixpkgs/blob/91f7042aa09eb7488267a01a68c46bab05d8515e/pkgs/development/libraries/aspell/aspell-with-dicts.nix The expression you see is a function that is called with
The argument |
Of course the f was teh whole I believe I could make it work with adding a setupHook in lua/wrapper.nix but it's a passthru so that's not a good solution. I believe I should be able to export LUA_PATH as PYTHONPATH is exported but I am not sure how it does. I wish I could run the seup.sh with "set -x" but that would recompile everything I think :s |
So I have a script that can generate nix expressions (unessential fields are temporary ones for now such as the license field). Here is an example of the generated code from a subset of rockspecs.
Next step is to be able to install these packages. |
I managed to get something working at #33903 . I have managed to support the lua packages needed to run a neovim tests (a dozen) so I am quite happy with that. I dont have the mental strength to improve it further right now (nor the time) so I hope someone can pick it up. |
work has been merged recently to achieve this and more is going to follow. Thus closing. |
Issue description
I've been working towards better lua support in nixos (automatic export of LUA_PATH/LUA_CPATH so that it doesn't have to be done for each derivation as it is now). The start was pretty rough but I have now a better understanding of the building process.
When I do this, I would like LUA_CPATH to be set automatically so that lua can correctly
require "cjson"
when doingnix-shell ~/nixpkgs2 -p lua52Packages.cjson lua
.So far my
buildLuaPackage
function has lua as apropagatedBuildInputs
so the previous command should install lua. My lua interpreter has asetupHook
that runs a script which should populate the LUA_PATH via:envHooks+=(addToLuaPath)
.The problem is that the hook iterates over buildInputs of the lua package and thus don't scan the lua52Packages.cjson folder (since it's not a buildInput of lua). I am not sure how to cleanly solve this.
Having cjson adding itself to lua as a buildInput would mean recompiling lua depending on the derivations which is bad. I wonder if cjson could add itself to the lua passthrough and then use this in the hook ?
I believe python generates some kind of an environment but I am not sure really.
NB: the code is here https://github.com/teto/nixpkgs/tree/luafix but not sure that would help. It's a fucking mess. Most interesting files are mk-lua-package and 5.2.nix and the lua hooks.
The text was updated successfully, but these errors were encountered: