remove the inherit line did not work
fixes mpv for example
nix-repl> pkgsCross.aarch64-multiplatform.lua.withPackages (ps: with ps; [ luasocket ])
error: attribute 'runtimeShell' missing
at /home/artturin/nixgits/my-nixpkgs/pkgs/top-level/all-packages.nix:849:17:
848| substitutions = {
849| shell = targetPackages.runtimeShell;
| ^
850| passthru.tests = tests.makeWrapper;
… while evaluating the attribute 'shell' of the derivation 'hook'
at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating 'optionalString'
at /home/artturin/nixgits/my-nixpkgs/lib/strings.nix:203:5:
202| # String to return if condition is true
203| string: if cond then string else "";
| ^
204|
… from call site
at /home/artturin/nixgits/my-nixpkgs/pkgs/build-support/trivial-builders.nix:536:12:
535| cp ${script} $out/nix-support/setup-hook
536| '' + lib.optionalString (deps != []) ''
| ^
537| printWords ${toString deps} > $out/nix-support/propagated-build-inputs
… while evaluating the attribute 'buildCommand' of the derivation 'hook'
at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating anonymous lambda
at /home/artturin/nixgits/my-nixpkgs/lib/lists.nix:646:25:
645| */
646| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
647|
… from call site
at /home/artturin/nixgits/my-nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix:105:27:
104| # example externalDeps': [ { name = "CRYPTO"; dep = pkgs.openssl; } ]
105| externalDepsGenerated = lib.unique (lib.filter (drv: !drv ? luaModule) (
| ^
106| luarocksDrv.nativeBuildInputs ++ luarocksDrv.propagatedBuildInputs ++ luarocksDrv.buildInputs)
… while evaluating 'generateLuarocksConfig'
at /home/artturin/nixgits/my-nixpkgs/pkgs/development/lua-modules/lib.nix:83:28:
82| */
83| generateLuarocksConfig = {
| ^
84| externalDeps
… from call site
at /home/artturin/nixgits/my-nixpkgs/pkgs/development/interpreters/lua-5/build-lua-package.nix:85:23:
84| luarocks_content = let
85| generatedConfig = lua.pkgs.lib.generateLuarocksConfig {
| ^
86| externalDeps = externalDeps ++ externalDepsGenerated;
… while evaluating the attribute 'configurePhase' of the derivation 'lua5.2-luasocket-3.0.0-1-aarch64-unknown-linux-gnu'
at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
… while evaluating anonymous lambda
at /home/artturin/nixgits/my-nixpkgs/lib/lists.nix:646:25:
645| */
646| unique = foldl' (acc: e: if elem e acc then acc else acc ++ [ e ]) [];
| ^
647|
… from call site
at /home/artturin/nixgits/my-nixpkgs/pkgs/development/lua-modules/lib.nix:5:6:
4| modules = filter hasLuaModule drvs;
5| in unique ([lua] ++ modules ++ concatLists (catAttrs "requiredLuaModules" modules));
| ^
6| # Check whether a derivation provides a lua module.
… while evaluating 'requiredLuaModules'
at /home/artturin/nixgits/my-nixpkgs/pkgs/development/lua-modules/lib.nix:3:24:
2| let
3| requiredLuaModules = drvs: with lib; let
| ^
4| modules = filter hasLuaModule drvs;
… from call site
at /home/artturin/nixgits/my-nixpkgs/pkgs/development/interpreters/lua-5/wrapper.nix:13:14:
12| env = let
13| paths = requiredLuaModules (extraLibs ++ [ lua ] );
| ^
14| in buildEnv {
… while evaluating the attribute 'passAsFile'
at /home/artturin/nixgits/my-nixpkgs/pkgs/build-support/buildenv/default.nix:77:5:
76| # XXX: The size is somewhat arbitrary
77| passAsFile = if builtins.stringLength pkgs >= 128*1024 then [ "pkgs" ] else [ ];
| ^
78| }
… while evaluating the attribute 'passAsFile' of the derivation 'lua-aarch64-unknown-linux-gnu-5.2.4-env'
at /home/artturin/nixgits/my-nixpkgs/pkgs/stdenv/generic/make-derivation.nix:270:7:
269| // (lib.optionalAttrs (attrs ? name || (attrs ? pname && attrs ? version)) {
270| name =
| ^
271| let
Neovim plugins are now more often than not written in lua.
One advantage of the lua ecosystem over vim's is the existence of
luarocks and the rockspec format, which allows to specify a package
dependencies formally.
I would like more neovim plugins to have a formal description,
"rockspec" being the current candidate.
This MR allows to use nix lua packages as neovim plugins, so as to enjoy
every benefit that rockspecs bring:
- dependdency discovery
- ability to run test suite
- luarocks versioning
- rockspec metadata
the vim update.py script will check if an attribute with the vim plugin
pname exists in lua51Packages. If it does, it uses
buildNeovimPluginFrom2Nix on it, which modifies the luarocks config to
do an almost flat install (luarocks will install the package in the lua
folder instead of share/5.1/lua etc).
It also calls toVimPlugin on it to get all the vim plugin niceties.
The list of packages that could benefit from this is available at
https://luarocks.org/labels/neovim
but I hope it grows.
luaLib.luaPathList is a list and not a function anymore which results in
the following error:
error: attempt to call something which is not a function but a list
at /nix/store/v94vpi9na0flcnhh9gbmzcvbgfzqm10g-source/pkgs/top-level/lua-packages.nix:50:35:
49| getLuaPath = drv: getPath drv (luaLib.luaPathList lua.luaversion) ;
50| getLuaCPath = drv: getPath drv (luaLib.luaCPathList lua.luaversion) ;
| ^
51|
- moved lua hooks to a specific folder as I foresee to add more
- moved generateLuarocksConfig to lib
- fix getLuaPath
- removed the useless rockspecDir
Goal is to improve separation between packages and utilities.
Can help with autocompletion/navigate nixpkgs faster.
Also it will help standardize how LUA_PATH is exported across packages,
so that one can more easily make lua changes across nixpkgs (for
instance changing where lua modules are installed).
This commit shows how to convert luarocks packages into (neo)vim ones.
The advantage for neovim lua plugins to register their rockspec (aka
package definition) is that the plugin can express its dependencies and
a few metadata through it.
continuation of #109595
pkgconfig was aliased in 2018, however, it remained in
all-packages.nix due to its wide usage. This cleans
up the remaining references to pkgs.pkgsconfig and
moves the entry to aliases.nix.
python3Packages.pkgconfig remained unchanged because
it's the canonical name of the upstream package
on pypi.
- Lua packages now consistently use LUA_PATH/LUA_CPATH rather than a mix
of those and NIX_LUA_PATH/NIX_LUA_CPATH
- Lua libraries are now consistently only added to the search path
variables if:
1) The library actually has a corresponding directory to search
2) The library is not already present in the search path
This should help prevent the search paths from growing overly large
- Fixed bugs in some path helpers
- Changed the affected shell script indentation to 2 spaces; nixpkgs
shell scripts are inconsistently split between 2 and 4 space
indentation, but 2 matches better with the Nix expressions, so IMO it
makes more sense
luaPackages replaced by generated ones:
- bit32
- compat53
- cqueues
- luacyrussasl -> cyrussasl (luarocks name)
- luaexpat
- luadbi -> luadbi front-end module + separate backend modules
luadbi-{mysql,postgresql,sqlite3}
- luafilesystem
- luaossl
- luasec
- luasocket
- luastdlib -> stdlib (luarocks name)
- lrexlib -> lrexlib-pcre (we already have lrexlib-gnu and
lrexlib-posix, lrexlib-pcre however appears to be the variant used in
mudlet, which is the only current dep in nixpkgs)
- luasqlite -> luasql-sqlite3 (luarocks name)
- lfs -> luafilesytem (we literally had two manually written
luafilesystem expressions, under different names)
Changes and additions to overrides to generated luarocks packgaes,
including:
- busted: Install bash completions along with the zsh ones
- cqueues:
- Perform minor surgery on the rockspec to allow using a single
rockspec to build for all supported Lua versions
- Add a patch by @vcunat to work around a build issue
- luuid: Wrote a tiny patch to allow for Lua 5.1/Luajit compatibility
- General changes:
- Sorted the packages
- Attempted to make the formatting consistent
- Preferenced `.override` instead of `.overrideAttrs` wherever
possible
Minor changes to other packages to adjust for the Lua package changes:
- luakit expression simplified
- prosody expression simplified; but users will now need to specify the
luadbi backend module they intend to use in withExtraLibs
- knot-resolver inputs correctd
- mudlet inputs corrected (although this package was and should still be
broken)
One bugfix patch is included - merged upstream but not released yet.
knot-resolver wrapper would need to add binaryheap explicitly,
so it's migrated to the automatic LUA path discovery instead.
Test case that should execute without an error:
echo "require('ssl.https')" | env NIX_PATH=nixpkgs=$(pwd) \
nix-shell --pure -p lua -p lua.pkgs.luasec --run lua