!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

707 Members
Rust163 Servers

Load older messages


SenderMessageTime
8 Sep 2022
@figsoda:matrix.orgfigsoda I think you would need to set LD_LIBRARY_PATH to make it work with nix develop 00:54:00
@figsoda:matrix.orgfigsoda nix-shell should work though 00:54:22
@dpc:matrix.orgdpchttps://github.com/fedimint/fedimint/blob/master/docs/nix-ci.md in case it's of any use it interest to anyone 15:52:00
@dpc:matrix.orgdpc* https://github.com/fedimint/fedimint/blob/master/docs/nix-ci.md in case it's of any use it interest to anyone Understanding Fedimint's Nix-based building system and CI15:52:33
@dpc:matrix.orgdpc * https://github.com/fedimint/fedimint/blob/master/docs/nix-ci.md Understanding Fedimint's Nix-based building system and CI in case it's of any use it interest to anyone16:08:47
12 Sep 2022
@withoutwithin:matrix.orgXe Iaso changed their profile picture.21:40:20
13 Sep 2022
@farcaller:matrix.orgfarcaller joined the room.17:44:41
@farcaller:matrix.orgfarcaller

anyone's using vscode and rust-analyzer? I've tried about a dozen configurations now and each one breaks in a new and exciting way :) what I want to have is nix shell that's capable of building a rust project and packaging it into docker with the openssl (rustls is known broken for my use case) and a working rust-analyzer so I could write the code with some LSP support. My very latest iteration was trying to use ipetkov/crane but rust-analyzer fails on that with

[ERROR rust_analyzer::lsp_utils] rust-analyzer failed to load workspace: Failed to find sysroot for Cargo.toml file /home/nixos/src/kube-cidr-manager/Cargo.toml. Is rust-src installed?: can't load standard library from sysroot
/nix/store/n7m9l6djxf3xcdc2dk9scc6rbpw825p9-rustc-1.63.0
(discovered via `rustc --print sysroot`)
try installing the Rust source the same way you installed rustc
17:49:14
@farcaller:matrix.orgfarcaller oh Xe Iaso, fancy seeing you around here. 17:49:36
@withoutwithin:matrix.orgXe IasoHi, i exist17:49:52
@withoutwithin:matrix.orgXe IasoI'm in a meeting right now so I'm at like 1/4th brain17:50:03
@farcaller:matrix.orgfarcaller also: I think rust-analyzer works because I got .envrc with use flake and a direnv plugin for vscode but that's some arcane magic at that point. 17:50:22
@farcaller:matrix.orgfarcallerimage.png
Download image.png
17:57:46
@farcaller:matrix.orgfarcalleropenssl works. kinda.17:57:51
@farcaller:matrix.orgfarcaller

If I add RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}" to my mkShell attrs then rust-analyzer seems to work too. To some extent:

proc macro `main` not expanded: Cannot create expander for /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so: Io(Custom { kind: InvalidData, error: DlOpen { desc: "/nix/store/0xxjx37fcy2nl3yz6igmv4mag2a7giq6-glibc-2.33-123/lib/libc.so.6: version `GLIBC_2.34\' not found (required by /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so)" } })rust-analyzerunresolved-proc-macro
18:11:15
@farcaller:matrix.orgfarcaller *

If I add RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}" to my mkShell attrs then rust-analyzer seems to work too. To some extent:

proc macro mainnot expanded: Cannot create expander for /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so: Io(Custom { kind: InvalidData, error: DlOpen { desc: "/nix/store/0xxjx37fcy2nl3yz6igmv4mag2a7giq6-glibc-2.33-123/lib/libc.so.6: versionGLIBC_2.34' not found (required by /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so)" } })rust-analyzerunresolved-proc-macro`

18:11:26
@farcaller:matrix.orgfarcaller *

If I add RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}" to my mkShell attrs then rust-analyzer seems to work too. To some extent:

proc macro mainnot expanded: Cannot create expander for /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so: Io(Custom { kind: InvalidData, error: DlOpen { desc: "/nix/store/0xxjx37fcy2nl3yz6igmv4mag2a7giq6-glibc-2.33-123/lib/libc.so.6: versionGLIBC\_2.34' not found (required by /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio\_macros-a639847ca16674fe.so)" } })rust-analyzerunresolved-proc-macro\

18:11:34
@farcaller:matrix.orgfarcaller *

If I add RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}" to my mkShell attrs then rust-analyzer seems to work too. To some extent:

proc macro mainnot expanded: Cannot create expander for /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so: Io(Custom { kind: InvalidData, error: DlOpen { desc: "/nix/store/0xxjx37fcy2nl3yz6igmv4mag2a7giq6-glibc-2.33-123/lib/libc.so.6: versionGLIBC\_2.34' not found (required by /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio\_macros-a639847ca16674fe.so)" } })rust-analyzerunresolved-proc-macro

18:11:37
@farcaller:matrix.orgfarcallerI have no idea why it looks up glibc 2.34 in what clearly is glibc 2.3318:12:11
@farcaller:matrix.orgfarcallerand given it's nixos I have no idea what's my glibc anywhere :(18:12:23
@x10an14:matrix.orgx10an14

I've tried the rust-analyzer and vscode (read: codium) combo too, but can't get it to work... Would some kind soul here be willing to take a look at my below paste and tell me what I'm doing wrong?
The rust-analyzer extension keeps complaning when I start up vscode - other than that I have no error messages (it complains about missing binaries for my OS - NixOS).

This is my first time ever using VS Code for rust, and first time ever touching rust-analyzer. Reading the Rust wiki and the plugins' issues didn't help me understand where to go from here. Any pointers anyone?
https://paste.sr.ht/~x10an14/c9d82c36b864b0bd334a9ffaf43e065da385f9bb

22:12:11
@x10an14:matrix.orgx10an14
In reply to @x10an14:matrix.org

I've tried the rust-analyzer and vscode (read: codium) combo too, but can't get it to work... Would some kind soul here be willing to take a look at my below paste and tell me what I'm doing wrong?
The rust-analyzer extension keeps complaning when I start up vscode - other than that I have no error messages (it complains about missing binaries for my OS - NixOS).

This is my first time ever using VS Code for rust, and first time ever touching rust-analyzer. Reading the Rust wiki and the plugins' issues didn't help me understand where to go from here. Any pointers anyone?
https://paste.sr.ht/~x10an14/c9d82c36b864b0bd334a9ffaf43e065da385f9bb

The flake was created with the command nix flake init --template github:the-nix-way/dev-templates#rust as a starting point.
22:20:32
@x10an14:matrix.orgx10an14 *

I've tried the rust-analyzer and vscode (read: codium) combo too, but can't get it to work... Would some kind soul here be willing to take a look at my below paste and tell me what I'm doing wrong?
The rust-analyzer extension keeps complaning when I start up vscode - other than that I have no error messages (it complains about missing binaries for my OS - NixOS).

This is my first time ever using VS Code for rust, and first time ever touching rust-analyzer (heck - first time ever using vscode on nix/nixos too). Reading the Rust wiki and the plugins' issues didn't help me understand where to go from here. Any pointers anyone?
https://paste.sr.ht/~x10an14/c9d82c36b864b0bd334a9ffaf43e065da385f9bb

22:21:28
@x10an14:matrix.orgx10an14
In reply to @farcaller:matrix.org

If I add RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}" to my mkShell attrs then rust-analyzer seems to work too. To some extent:

proc macro mainnot expanded: Cannot create expander for /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio_macros-a639847ca16674fe.so: Io(Custom { kind: InvalidData, error: DlOpen { desc: "/nix/store/0xxjx37fcy2nl3yz6igmv4mag2a7giq6-glibc-2.33-123/lib/libc.so.6: versionGLIBC\_2.34' not found (required by /home/nixos/src/kube-cidr-manager/target/debug/deps/libtokio\_macros-a639847ca16674fe.so)" } })rust-analyzerunresolved-proc-macro

I don't know how, but have you considered testing the fhs version in nixpkgs? I think it was referenced in the wiki page I linked in my above message.
22:22:43
14 Sep 2022
@farcaller:matrix.orgfarcaller
In reply to @x10an14:matrix.org
I don't know how, but have you considered testing the fhs version in nixpkgs? I think it was referenced in the wiki page I linked in my above message.
nothing in the toolchain should require fhs per se, though, no?
08:29:07
@x10an14:matrix.orgx10an14
In reply to @farcaller:matrix.org
nothing in the toolchain should require fhs per se, though, no?
I dunno, I only came across this in the wiki like I said. I'm really at a loss here myself on my own issues with rust-analyzer
10:08:02
@x10an14:matrix.orgx10an14
In reply to @farcaller:matrix.org
nothing in the toolchain should require fhs per se, though, no?
*

I dunno, I only came across this in the wiki like I said. I'm really at a loss here myself on my own issues with rust-analyzer

https://nixos.wiki/wiki/Visual_Studio_Code#Use_VS_Code_extensions_without_additional_configuration

10:08:19
@farcaller:matrix.orgfarcallerah right. my vscode is outside of nix so I don't think that applies.10:08:50
@pennae:matrix.eno.spacepennae left the room.14:11:10
@x10an14:matrix.orgx10an14
In reply to @x10an14:matrix.org

I've tried the rust-analyzer and vscode (read: codium) combo too, but can't get it to work... Would some kind soul here be willing to take a look at my below paste and tell me what I'm doing wrong?
The rust-analyzer extension keeps complaning when I start up vscode - other than that I have no error messages (it complains about missing binaries for my OS - NixOS).

This is my first time ever using VS Code for rust, and first time ever touching rust-analyzer (heck - first time ever using vscode on nix/nixos too). Reading the Rust wiki and the plugins' issues didn't help me understand where to go from here. Any pointers anyone?
https://paste.sr.ht/~x10an14/c9d82c36b864b0bd334a9ffaf43e065da385f9bb

I found a solution to my issue (I think - still veryfing/testing).

The rust-lang.rust-analyzer extension supports a "rust-analyzer.server.path": "rust-analyzer" setting, which can be put in <project/git repo root>/.vscode/settings.json. That along with the arrterian.nix-env-selector extension (and required shell.nix since I use flakes) seem to have done the trick for me.

Many thanks to @NobbZ on the Unofficial Nix/NixOS Discord Server for sharing the solution.

15:29:58

Show newer messages


Back to Room ListRoom Version: 6