Also rewrote the derivation for easier maintencence.
(And added @ysndr as maintainer for atom-beta, kind of an implicit
result of joining the two. If you're not okay with that, I'll patch
you out, but I'll presume consent.)
Semi-automatic update generated by https://github.com/ryantm/nixpkgs-update tools.
This update was made based on information from https://repology.org/metapackage/atom/versions.
These checks were done:
- built on NixOS
- ran ‘/nix/store/q560gnycgnl44jmldg5y2a9akg47q8kb-atom-1.26.0/bin/apm -h’ got 0 exit code
- ran ‘/nix/store/q560gnycgnl44jmldg5y2a9akg47q8kb-atom-1.26.0/bin/apm --help’ got 0 exit code
- ran ‘/nix/store/q560gnycgnl44jmldg5y2a9akg47q8kb-atom-1.26.0/bin/apm help’ got 0 exit code
- ran ‘/nix/store/q560gnycgnl44jmldg5y2a9akg47q8kb-atom-1.26.0/bin/atom help’ got 0 exit code
- ran ‘/nix/store/q560gnycgnl44jmldg5y2a9akg47q8kb-atom-1.26.0/bin/.atom-wrapped help’ got 0 exit code
- found 1.26.0 with grep in /nix/store/q560gnycgnl44jmldg5y2a9akg47q8kb-atom-1.26.0
- directory tree listing: https://gist.github.com/10c433ad7807e5aeaa581f442b89dd6c
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.