| 2 Dec 2021 |
brendanzab | Re. developing in a shell, do you do it on a per-package basis, or do you install cargo/rust globally? I know the latter probably isn't recommended, but seems like it could be easier for the random Rust project? | 00:24:41 |
Ralith | I have a shell per project; they tend to vary | 02:01:30 |
Ralith | you can have a common shell that you reuse though | 02:01:46 |
brendanzab | how do you cope if a project is not using nix? | 02:05:01 |
brendanzab | do you make a personal project-specific nix thing? | 02:05:23 |
brendanzab | * do you make a personal project-specific nix thing that you hide in your local ignores? | 02:05:36 |
brendanzab | at any rate, this is what I ended up with: https://gist.github.com/brendanzab/8b9f1abfc28fca8fbdef745995be3a76 | 02:06:22 |
brendanzab | dunno if it can be simplified more | 02:06:50 |
brendanzab | I've got an .envrc that loads it, and seems to work nicely with vs code | 02:07:23 |
brendanzab | * I've got an .envrc that loads it, and seems to work nicely with vs code and rust-analyzer with no dramas | 02:07:36 |
Ralith | yeah I drop local shell.nixes in stuff all the time | 05:39:42 |
| Patsakula Nikita joined the room. | 14:20:19 |
Patsakula 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 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 |
Mark | LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib" | 18:00:37 |
Mark | Patsakula Nikita: that should do the trick | 18:00:59 |
Mark | i'm using that for building a thing which is using librocksdb-sys | 18:01:27 |
Mark | that's an attribute btw | 18:02:48 |
Mark | but i'm not 100% sure if that'll work with this derivation, derivation i'm using this in is using rustPlatform.buildRustPackage | 18:04:06 |
jonringer | cargo makes heavy usage of pkg-config. Usually adding that to nativeBuildInputs fixes most search logic | 20:44:51 |
Mark | librocksdb-sys is using rust-bindgen, which in turn is using libclang to parse C/C++ headers | 20:47:50 |
Mark | having pkg-config in nativeBuildInputs does not help getting rust-bindgen working unfortunately | 20:48:44 |
Mark | https://github.com/KyleMayes/clang-sys#environment-variables | 20:53:28 |
Mark | rust-bindgen is using clang-sys | 20:53:46 |
Mark | perhaps providing llvm-config path is cleaner | 20:54:01 |
| 3 Dec 2021 |
Patsakula 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 joined the room. | 10:47:49 |
| abose joined the room. | 23:23:07 |
| 10 Dec 2021 |
| linj joined the room. | 00:54:01 |
brendanzab | 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 |