luajitPackages not in lua runtime path

Hello everyone.

I’m trying to access luajit packages I added to my home manager, but I get the following error:

lua: module 'luv' not found: 
        no field package.preload['luv'] 
        no file './luv.lua' 
        no file '/nix/store/s2q178smkfc62l0lg2ir8hp3qqyyc8yl-luajit-2.1.0-2020-12-28/share/luajit-2.1.0-beta3/luv.lua' 
        no file '/usr/local/share/lua/5.1/luv.lua' 
        no file '/usr/local/share/lua/5.1/luv/init.lua' 
        no file '/nix/store/s2q178smkfc62l0lg2ir8hp3qqyyc8yl-luajit-2.1.0-2020-12-28/share/lua/5.1/luv.lua' 
        no file '/nix/store/s2q178smkfc62l0lg2ir8hp3qqyyc8yl-luajit-2.1.0-2020-12-28/share/lua/5.1/luv/init.lua' 
        no file './' 
        no file '/usr/local/lib/lua/5.1/' 
        no file '/nix/store/s2q178smkfc62l0lg2ir8hp3qqyyc8yl-luajit-2.1.0-2020-12-28/lib/lua/5.1/' 
        no file '/usr/local/lib/lua/5.1/' 
stack traceback: 
        [C]: in function 'require' 

        [C]: at 0x004062c0 
zsh: exit 1     ptf 

As it seem packages are either not installed or not in lua path, is there a workaround to access those packages or to put them in lua runtime, or should I install them some different way?

{ config, pkgs, libs, ... }:
  home.packages = with pkgs; [



You can not install libraries like that, you need to wrap in a package.

If you want to have packages available system wide you need to manually maintain apropriate environment variables or compiler/runtime binary.

Though the most favored way is probably to use proper nix shells to keep a dev environment or package your scripts.

Please see also FAQ - NixOS Wiki, which is about C-libraries but applies for about any other runtime as well.