Skip to content

Commit

Permalink
mpv: don't use generated luasocket
Browse files Browse the repository at this point in the history
The luarocks version of luasocket crashes if the host program has
symbols with the same name as luasocket, such as "socket_create".

This change makes mpv use a custom luasocket derivation that isn't built
from luarocks. This new derivation has the same code as
"luaPackages.luasocket" before commit
274715c.

Closes NixOS#88584
  • Loading branch information
cript0nauta committed May 29, 2020
1 parent e6f4426 commit f9bcddf
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkgs/applications/video/mpv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ assert xvSupport -> x11Support && available libXv;
assert zimgSupport -> available zimg;

let
luaEnv = lua.withPackages (ps: with ps; [ luasocket ]);
luaEnv = lua.withPackages (ps: with ps; [ luasocket-git ]);

in stdenv.mkDerivation rec {
pname = "mpv";
Expand Down
39 changes: 39 additions & 0 deletions pkgs/top-level/lua-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,45 @@ with self; {

luarocks-nix = callPackage ../development/tools/misc/luarocks/luarocks-nix.nix { };

luasocket-git = buildLuaPackage rec {
name = "socket-${version}";
version = "3.0-rc1";

src = fetchFromGitHub {
owner = "diegonehab";
repo = "luasocket";
rev = "v${version}";
sha256 = "1chs7z7a3i3lck4x7rz60ziwbf793gw169hpjdfca8y4yf1hzsxk";
};

patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
substituteInPlace src/makefile \
--replace 10.3 10.5
'';

preBuild = ''
makeFlagsArray=(
LUAV=${lua.luaversion}
PLAT=${platformString}
CC=''${CC}
LD=''${CC}
prefix=$out
);
'';

doCheck = false; # fails to find itself

installTargets = [ "install" "install-unix" ];

meta = with stdenv.lib; {
description = "Network support for Lua";
homepage = "http://w3.impa.br/~diego/software/luasocket/";
license = licenses.mit;
maintainers = with maintainers; [ ];
platforms = with platforms; darwin ++ linux ++ freebsd ++ illumos;
};
};

luxio = buildLuaPackage rec {
name = "luxio-${version}";
version = "13";
Expand Down

0 comments on commit f9bcddf

Please sign in to comment.