diff --git a/pkgs/development/python-modules/selenium/default.nix b/pkgs/development/python-modules/selenium/default.nix index 6b64cd18b4fa..1661dd2cf3aa 100644 --- a/pkgs/development/python-modules/selenium/default.nix +++ b/pkgs/development/python-modules/selenium/default.nix @@ -7,6 +7,19 @@ , xorg }: + +let + # Recompiling x_ignore_nofocus.so as the original one dlopen's libX11.so.6 by some + # absolute paths. Replaced by relative path so it is found when used in nix. + x_ignore_nofocus = + fetchFromGitHub { + owner = "SeleniumHQ"; + repo = "selenium"; + rev = "selenium-3.6.0"; + sha256 = "13wf4hx4i7nhl4s8xkziwxl0km1j873syrj4amragj6mpip2wn8v"; + }; +in + buildPythonPackage rec { pname = "selenium"; version = "3.6.0"; @@ -23,21 +36,11 @@ buildPythonPackage rec { geckodriver ]; - # Recompiling x_ignore_nofocus.so as the original one dlopen's libX11.so.6 by some - # absolute paths. Replaced by relative path so it is found when used in nix. - x_ignore_nofocus = - fetchFromGitHub { - owner = "SeleniumHQ"; - repo = "selenium"; - rev = "selenium-3.6.0"; - sha256 = "13wf4hx4i7nhl4s8xkziwxl0km1j873syrj4amragj6mpip2wn8v"; - }; - - patchPhase = '' + patchPhase = stdenv.lib.optionalString stdenv.isLinux '' cp "${x_ignore_nofocus}/cpp/linux-specific/"* . substituteInPlace x_ignore_nofocus.c --replace "/usr/lib/libX11.so.6" "${xorg.libX11.out}/lib/libX11.so.6" - gcc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o - gcc -shared \ + cc -c -fPIC x_ignore_nofocus.c -o x_ignore_nofocus.o + cc -shared \ -Wl,${if stdenv.isDarwin then "-install_name" else "-soname"},x_ignore_nofocus.so \ -o x_ignore_nofocus.so \ x_ignore_nofocus.o