!FBuJyWXTGcGtHTPphC:nixos.org

Nix Rust

670 Members
Rust152 Servers

Load older messages


SenderMessageTime
2 Dec 2021
@patsakula:matrix.orgPatsakula Nikita Hello! I am nix-noobie and I need a little help:( I tried to use cargo2nix with my project and faced the problem: one of my dependencies using libclang.so and I figured out how to add it as a dependency, but I don't know how to inject shellHook (it don't see the path without it). I will be glad any hint! 14:30:09
@patsakula:matrix.orgPatsakula Nikita
            (pkgs.rustBuilder.rustLib.makeOverride {
              name = "librocksdb-sys";
              overrideAttrs = drv: {
                propagatedNativeBuildInputs = drv.propagatedNativeBuildInputs or [ ] ++ [
                  pkgs.llvmPackages_13.libclang
                ];
                # It didn't help:
                paths = [
                  pkgs.llvmPackages_13.libclang
                ];
              };
            })

My flake.nix ^

 >   thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"', src/lib.rs:2144:31

Error message ^

14:42:03
@mikroskeem:d0.eeMark LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib" 18:00:37
@mikroskeem:d0.eeMarkPatsakula Nikita: that should do the trick18:00:59
@mikroskeem:d0.eeMarki'm using that for building a thing which is using librocksdb-sys18:01:27
@mikroskeem:d0.eeMarkthat's an attribute btw18:02:48
@mikroskeem:d0.eeMarkbut i'm not 100% sure if that'll work with this derivation, derivation i'm using this in is using rustPlatform.buildRustPackage18:04:06
@jonringer:matrix.orgjonringer cargo makes heavy usage of pkg-config. Usually adding that to nativeBuildInputs fixes most search logic 20:44:51
@mikroskeem:d0.eeMarklibrocksdb-sys is using rust-bindgen, which in turn is using libclang to parse C/C++ headers20:47:50
@mikroskeem:d0.eeMarkhaving pkg-config in nativeBuildInputs does not help getting rust-bindgen working unfortunately20:48:44
@mikroskeem:d0.eeMarkhttps://github.com/KyleMayes/clang-sys#environment-variables20:53:28
@mikroskeem:d0.eeMarkrust-bindgen is using clang-sys20:53:46
@mikroskeem:d0.eeMarkperhaps providing llvm-config path is cleaner20:54:01
3 Dec 2021
@patsakula:matrix.orgPatsakula Nikita
In reply to @mikroskeem:d0.ee
Patsakula Nikita: that should do the trick

Yes, it works, but only with:

propagatedNativeBuildInputs = drv.propagatedNativeBuildInputs or [ ] ++ [
  pkgs.llvmPackages_13.libcxxClang
];

..and now I don't know how to use non-default cc (stdenv = pkgs.llvmPackages_13.stdenv didn't work)

16:17:14
5 Dec 2021
@pinage404:matrix.orgpinage404 joined the room.10:47:49
@abose:matrix.orgabose joined the room.23:23:07
10 Dec 2021
@linj:matrix.orglinj joined the room.00:54:01
@brendanzab:matrix.orgbrendanzab Hey, just wondering if it is a good idea to use something like https://github.com/hercules-ci/gitignore.nix in a flake for my Rust package? I'm using https://github.com/nix-community/naersk/ to define my default package, but I'm not sure if that handles stuff like ignoring the target directory. 🤔 06:49:29
@mic92:nixos.devMic92If you switch to flake-based infrastructure than you can gitignore support for free.07:02:51
@brendanzab:matrix.orgbrendanzaboh cool07:16:28
@brendanzab:matrix.orgbrendanzabweird that hercules-ci/gitignore.nix mentions flakes in the README - is that possibly out of date?07:17:22
@mic92:nixos.devMic92brendanzab: well. it says that flakes uses gitignore but there might be an edge case where this is still useful.08:22:19
@brendanzab:matrix.orgbrendanzabahh rereading that yeah… gotcha08:30:42
12 Dec 2021
@linj:matrix.orglinj left the room.21:44:07
13 Dec 2021
@ldesgoui:matrix.orgldesgoui joined the room.00:21:58
@wardmuylaert:matrix.orgward joined the room.08:53:10
@lourkeur:nixos.devlourkeur (nix btw) changed their display name from lourkeur (Nix OwO) to lourkeur (nix btw).17:13:05
19 Dec 2021
@psibi:matrix.orgpsibi joined the room.14:47:57
@colemickens:matrix.orgcolemickens joined the room.22:53:19
22 Dec 2021
@bernardo:matrix.parity.iobernardo joined the room.22:26:59

Show newer messages


Back to Room ListRoom Version: 6