!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

473 Members
Rust115 Servers

Load older messages


SenderMessageTime
4 Sep 2024
@prism019:matrix.orgPrism019Apologies for that, phone was unlocked in my pocket.05:28:59
@julius:mtx.liftm.deˈt͡sɛːzaɐ̯ ("Talk to the hand" was common phrase in my school days to shut someone up. Now I talked to the butt. ;)) 05:32:56
@justastream:matrix.orgStream joined the room.09:45:15
@justastream:matrix.orgStreamhey friends09:45:22
@justastream:matrix.orgStream

I'm really hoping some of you have the technical know-how to help me here, because I really don't want to uninstall NixOs!

For simplicity, all I want is a global install of rustup or oxalica/rust-overlay so I can write Rust code again!

I've got Rust compiling in shell.nix but I'm keen on a global install (I'm a full time Rust engineer) that plays nice with my RustRover IDE.

Setup:

  • OS: NixOs
  • Flakes: enabled
  • IDE: RustRover

Can someone please please help me? I took two days off this week to contribute to OSS and all I've managed is to beat my head against a Nix wall 🙏

09:58:00
@k900:0upti.meK900 Generally, adding rustup to environment.systemPackages should mostly work 09:58:42
@k900:0upti.meK900But also, generally, you don't actually want a system-wide install09:58:54
@justastream:matrix.orgStream

Oh, forgot to add, my "rustup environment.systemPackages" doesn't work because:

  The system library `openssl` required by crate `openssl-sys` was not found.
  The file `openssl.pc` needs to be installed and the PKG_CONFIG_PATH environment variable must contain its parent directory.
  The PKG_CONFIG_PATH environment variable is not set.

  HINT: if you have installed the library, try setting PKG_CONFIG_PATH to the directory containing `openssl.pc`.


  --- stderr
  thread 'main' panicked at /home/justastream/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.103/build/find_normal.rs:190:5:


  Could not find directory of OpenSSL installation, and this `-sys` crate cannot
  proceed without this knowledge. If OpenSSL is installed and this crate had
  trouble finding it,  you can set the `OPENSSL_DIR` environment variable for the
  compilation process.

  Make sure you also have the development packages of openssl installed.
  For example, `libssl-dev` on Ubuntu or `openssl-devel` on Fedora.

  If you're in a situation where you think the directory *should* be found
  automatically, please open a bug at https://github.com/sfackler/rust-openssl
  and include information about your system as well as this message.

  $HOST = x86_64-unknown-linux-gnu
  $TARGET = x86_64-unknown-linux-gnu
  openssl-sys = 0.9.103


  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
10:00:14
@k900:0upti.meK900That's not a rustup issue10:00:23
@k900:0upti.meK900That's basically the reason you don't want a system-wide install10:00:34
@k900:0upti.meK900It's trying to find openssl, which is a C library10:00:41
@k900:0upti.meK900Which is generally not something Nix is designed to provide access to system-wdie10:00:53
@k900:0upti.meK900* Which is generally not something Nix is designed to provide access to system-wide10:00:55
@justastream:matrix.orgStream

In order to satisfy the requirements, I added all the deps system wide that I did to get my shell.nix to work:

rustup 
openssl
openssl.dev
pkg-config
clang
llvmPackages.bintools 
libiconv
gcc
clang
10:02:31
@k900:0upti.meK900Yeah, the problem is that it will not set up the environment correctly10:02:44
@k900:0upti.meK900For those things to actually be findable10:02:48
@k900:0upti.meK900 Because adding things to environment.systemPackages and adding them to a dev shell's inputs doesn't actually do the same thing 10:03:03
@justastream:matrix.orgStreamI'm open to a non-system wide install but so far all I've managed to get working is shell.nix and I can't get that to work with RustRover10:03:05
@k900:0upti.meK900They are subtly different10:03:09
@k900:0upti.meK900You probably want to use direnv for IDE integration10:03:34
@k900:0upti.meK900See https://direnv.net/10:03:40
@k900:0upti.meK900And https://plugins.jetbrains.com/plugin/15285-direnv-integration for JetBrains stuff specifically10:04:21
@k900:0upti.meK900 Then you can just put use nix in your .envrc 10:04:29
@k900:0upti.meK900And the IDE should inherit those settings10:04:35
@k900:0upti.meK900Though to be honest I'm not sure how well it works with RustRover10:05:09
@k900:0upti.meK900I usually just use VSCode with rust-analyzer for Rust stuff10:05:19
@justastream:matrix.orgStreamOkay i'm going to follow your suggestion and try and get my shell.nix to work with my IDE10:12:21
@justastream:matrix.orgStream

Hey K900 , quick Q. When I try to use nix in my rust project directory I get the 'no such file or directory as default.nix'.

I have a ~/shell.nix file. Is there some way to use that?

10:54:10
@k900:0upti.meK900 Try use nix ~/shell.nix 10:55:05
@justastream:matrix.orgStream Thanks for the help! I don't have things as convenient as I want them but I've finally got my IDE to recognise Rust. I can't seem to get it to work directly from .envrc but if I run nix-shell then rust-rover my IDE seems to work 🙏 11:18:26

Show newer messages


Back to Room ListRoom Version: 6