2021-06-10 02:57:09 +00:00
|
|
|
{ stdenv, lib, zlib, glib, alsa-lib, dbus, gtk3, atk, pango, freetype, fontconfig
|
2021-09-04 20:05:03 +00:00
|
|
|
, libgnome-keyring3, gdk-pixbuf, cairo, cups, expat, libgpg-error, nspr
|
2019-12-30 19:28:31 +00:00
|
|
|
, gconf, nss, xorg, libcap, systemd, libnotify, libsecret, libuuid, at-spi2-atk
|
2021-06-10 00:27:58 +00:00
|
|
|
, at-spi2-core, libdbusmenu, libdrm, mesa
|
2016-04-22 10:51:11 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
packages = [
|
2018-06-29 13:10:17 +00:00
|
|
|
stdenv.cc.cc zlib glib dbus gtk3 atk pango freetype libgnome-keyring3
|
2021-09-04 20:05:03 +00:00
|
|
|
fontconfig gdk-pixbuf cairo cups expat libgpg-error alsa-lib nspr gconf nss
|
2016-04-22 10:51:11 +00:00
|
|
|
xorg.libXrender xorg.libX11 xorg.libXext xorg.libXdamage xorg.libXtst
|
|
|
|
xorg.libXcomposite xorg.libXi xorg.libXfixes xorg.libXrandr
|
atom: avoid using LD_PRELOAD. Fixes glibc compat issues
The wrapper for Atom was loading libraries via LD_PRELOAD, for example
libxkbfile. Now, if you installed atom via nix-env and happened to use a newer
nixpkgs for that than what your system environment is build against, you could
end up with an error like this:
```
uname: relocation error:
/nix/store/68sa3m89shpfaqq1b9xp5p1360vqhwx6-glibc-2.25/lib/libdl.so.2:
symbol _dl_catch_error, version GLIBC_PRIVATE not defined in file libc.so.6
with link time reference
```
This happens because atom calls the `uname` executable from the system to
determine the platform. Because that inherits the `LD_PRELOAD` environment
variable, so the libxkbfile library that the `atom` wrapper was build against
is loaded into `uname`. But since `atom` comes from `nix-env`, the `libxkbfile`
it was built with might be compiled against a newer version of `glibc` than
`uname`, which comes from the system, was! Having two versions of glibc loaded
into the same processes results in chaos.
To fix this, we avoid setting `LD_PRELOAD` and instead use patchelf to set the
correct RPATH. RPATH is not inherited by child processes, so the above issue
can no longer occur.
The only small complication here is that the library that actually loads
libxkbfile is not the atom binary itself, but a node extension that atom uses.
So instead of setting the RPATH on `atom` only, we also set the `rpath` on all
node extensions (`*.node`) the output.
2017-03-18 00:39:14 +00:00
|
|
|
xorg.libXcursor xorg.libxkbfile xorg.libXScrnSaver libcap systemd libnotify
|
2021-03-11 08:51:54 +00:00
|
|
|
xorg.libxcb libsecret libuuid at-spi2-atk at-spi2-core libdbusmenu
|
2021-06-10 00:27:58 +00:00
|
|
|
libdrm
|
2021-04-08 21:04:27 +00:00
|
|
|
mesa # required for libgbm
|
2016-04-22 10:51:11 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
libPathNative = lib.makeLibraryPath packages;
|
2016-04-25 10:23:56 +00:00
|
|
|
libPath64 = lib.makeSearchPathOutput "lib" "lib64" packages;
|
2016-04-22 10:51:11 +00:00
|
|
|
libPath = "${libPathNative}:${libPath64}";
|
|
|
|
|
|
|
|
in { inherit packages libPath; }
|