xhyrom / zed-discord-presence

extension for zed that adds support for discord rich presence using lsp
https://git.sr.ht/~hyro/zed-discord-presence
GNU General Public License v3.0
111 stars 5 forks source link

Not working on NixOS #12

Closed ShiinaShy closed 2 months ago

ShiinaShy commented 2 months ago

extension (installed via store) does not work on NixOS:

2024-09-08T14:34:28.896850273+02:00 [INFO] starting language server "discord_presence", path: "/home/shiina/.DotNix", id: 8
2024-09-08T14:34:28.910265238+02:00 [INFO] starting language server. binary path: "/home/shiina/.local/share/zed/extensions/work/discord-presence/discord-presence-lsp-v0.5.0/discord-presence-lsp-x86_64-unknown-linux-gnu/discord-presence-lsp", working directory: "/home/shiina/.DotNix", args: []
2024-09-08T14:34:28.910578725+02:00 [ERROR] cannot read LSP message headers
2024-09-08T14:34:28.910622264+02:00 [ERROR] Broken pipe (os error 32)
2024-09-08T14:34:28.910659084+02:00 [ERROR] server shut down
2024-09-08T14:34:28.910684824+02:00 [ERROR] failed to start language server "discord_presence": oneshot canceled
2024-09-08T14:34:28.910709784+02:00 [ERROR] server stderr: Some("Could not start dynamically linked executable: /home/shiina/.local/share/zed/extensions/work/discord-presence/discord-presence-lsp-v0.5.0/discord-presence-lsp-x86_64-unknown-linux-gnu/discord-presence-lsp\nNixOS cannot run dynamically linked executables intended for generic\nlinux environments out of the box. For more information, see:\nhttps://nix.dev/permalink/stub-ld\n")
2024-09-08T14:34:28.910744793+02:00 [INFO] retrying installation of language server "discord_presence" in 1s
2024-09-08T14:34:29.891895999+02:00 [INFO] About to spawn test binary
2024-09-08T14:34:29.891933568+02:00 [WARN] test binary failed to launch
2024-09-08T14:34:29.891961038+02:00 [WARN] test binary check failed
2024-09-08T14:34:29.891989508+02:00 [INFO] beginning to reinstall server
2024-09-08T14:34:29.892022488+02:00 [INFO] deleting server container
2024-09-08T14:34:29.892071067+02:00 [ERROR] server container removal

NixOS cannot run dynamically linked executables intended for generic linux environments out of the box. For more information, see: https://nix.dev/permalink/stub-ld"

Edit: ldd output for discord-presence-lsp

linux-vdso.so.1 (0x00007ffee03fb000)
libz.so.1 => not found
libgcc_s.so.1 => /nix/store/mrsnnz2nmnb4mrma1bfv6inmy2k3k3k8-xgcc-13.3.0-libgcc/lib/libgcc_s.so.1 (0x00007f0ce6be0000)
libm.so.6 => /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libm.so.6 (0x00007f0ce6afa000)
libc.so.6 => /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib/libc.so.6 (0x00007f0ce6409000)
/lib64/ld-linux-x86-64.so.2 => /nix/store/wlffq5p6mxxgfap10sav3ij936jzqm59-glibc-2.39-52/lib64/ld-linux-x86-64.so.2 (0x00007f0ce6c07000)
xhyrom commented 2 months ago

I don't think I can do something with this.

ShiinaShy commented 2 months ago

I also don't think I could help a lot here. I am pretty new to Nix. All i know is that Nix does not follow the Filesystem Hierarchy Standard, which means that dynamically linked executables need to be specially compiled in order to work. I am not even sure if it would work as an extension like this at all, depending on what dependencies it has? Would probably need someone that knows more about Nix to help here. Just thought I at least could bring it up.

fdnt7 commented 2 months ago

This is related to https://github.com/NixOS/nixpkgs/issues/309662. I came up with this, and it seems to work just fine:

environment.systemPackages = [
  (zed-editor.fhsWithPackages (pkgs: [ pkgs.zlib ]))
];

You can try this and see if it works for you.

KostaGorod commented 1 month ago

This is related to NixOS/nixpkgs#309662. I came up with this, and it seems to work just fine:

environment.systemPackages = [
  (zed-editor.fhsWithPackages (pkgs: [ pkgs.zlib ]))
];

You can try this and see if it works for you.

solved my issues with RPC request GetCachedEmbeddings failed: permission denied : failed to fetch cached embeddings via cloud model and copilot fails to initialize!.

should we add this to nixpkg?