I need some help installing sublime text 3 in Nixos 17.03. I have downloaded and unpacked the tar ball from sublime and this it was happens when I try to execute /opt/sublime_text/sublime_text:
/opt/sublime_text/sublime_text
sh: /opt/sublime_text/sublime_text: No such file or directory
The file exist in the correct location with run permissions.
sh-4.4$ cd /opt/sublime_text/
sh-4.4$ ls -la
totalt 15944
drwxr-xr-x 4 jan users 4096 23 sep 2016 .
drwxr-xr-x 7 jan users 4096 30 apr 23.28 ..
-rw-r--r-- 1 jan users 30118 23 sep 2016 changelog.txt
-rwxr-xr-x 1 jan users 488672 23 sep 2016 crash_reporter
drwxr-xr-x 7 jan users 4096 23 sep 2016 Icon
drwxr-xr-x 2 jan users 4096 23 sep 2016 Packages
-rwxr-xr-x 1 jan users 7883616 23 sep 2016 plugin_host
-rw-r--r-- 1 jan users 2624408 23 sep 2016 python3.3.zip
-rw-r--r-- 1 jan users 28578 23 sep 2016 sublime_plugin.py
-rw-r--r-- 1 jan users 37137 23 sep 2016 sublime.py
-rwxr-xr-x 1 jan users 5200392 23 sep 2016 sublime_text
-rw-r--r-- 1 jan users 532 23 sep 2016 sublime_text.desktop
Yes, the file does exist there and is executable! But, the error message is misleading.
Try to run file
command on that ELF file:
$ file ./sublime_text
./sublime_text: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=e359d67c8f71f88174135aefc069239f64f26c42, stripped
You see, it refers to /lib/ld-linux.so.2
interpreter library, which doesn't exist on NixOS.
Though sublimetext3 is packaged in Nixpkgs, and we can see that it refers to another interpreter:
$ file /nix/store/bv5j4qiif1h9db6qcfl9axhv7rvza2b8-sublimetext3-3114-bin/.sublime_text-wrapped
/nix/store/bv5j4qiif1h9db6qcfl9axhv7rvza2b8-sublimetext3-3114-bin/.sublime_text-wrapped: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /nix/store/jm1n87rp8vr90j9ahcrfzr57nc2r8vgf-glibc-2.24/lib/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=93b181f0f699bd88a052048070efe8ad6757a6fd, stripped
This is achieved by running patchelf
on the binary, which is a common trick in Nixpkgs/NixOS to fix binaries.