我正在尝试设置一个包含 lua 5.2、lua 套接字库和其他一些库的 nix-shell 脚本。但是,当我加载 shell 时,最终只有 Lua 存在。
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "lua-env";
buildInputs = [ lua52Packages.lua lua52Packages.luasocket lua52Packages.luasec lua52Packages.cjson ];
}
当我运行 shell 时,这就是我得到的:
savanni@lapis:~ $ nix-shell lua.nix
[nix-shell:~]$ lua
Lua 5.2.3 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> require 'socket'
stdin:1: module 'socket' not found:
no field package.preload['socket']
no file '/usr/share/lua/5.2/socket.lua'
no file '/usr/share/lua/5.2/socket/init.lua'
no file '/usr/lib/lua/5.2/socket.lua'
no file '/usr/lib/lua/5.2/socket/init.lua'
no file './socket.lua'
no file '/usr/lib/lua/5.2/socket.so'
no file '/usr/lib/lua/5.2/loadall.so'
no file './socket.so'
stack traceback:
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
>
[nix-shell:~]$ exit
savanni@lapis:~ $