Context: I’m trying to set up a flake for a rust crate that uses bindings to a C++ library
steps to reproduce:
git clone https://github.com/mmatvein/libliquidfun-sys.git
cd libliquidfun-sys
# download the flake from a Discord upload (or just paste it from this post)
wget -O flake.nix https://cdn.discordapp.com/attachments/1219445208421240852/1219445208727683122/flake.nix?ex=660b53d9&is=65f8ded9&hm=bea36aa375d5f32013ceff718b4b0c3c213e3e163c7223cb6bfb3e049d0d3463&
nix develop path:. # or add flake to git tracking
cargo build
youll get fatal error: 'algorithm' file not found
this seems a pretty basic error of not finding headers right? im not sure what packages im missing here can anyone help out
heres the flake right now:
{
inputs = {
rust-overlay.url = "github:oxalica/rust-overlay";
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.url = "nixpkgs";
};
};
outputs = {
self,
systems,
nixpkgs,
treefmt-nix,
...
} @ inputs: let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems) (
system:
f (import nixpkgs {
inherit system;
overlays = [inputs.rust-overlay.overlays.default];
})
);
rustToolchain = eachSystem (pkgs: pkgs.rust-bin.stable.latest);
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in {
devShells = eachSystem (pkgs: {
# Based on a discussion at https://github.com/oxalica/rust-overlay/issues/129
default = pkgs.mkShell.override {
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
} {
RUST_SRC_PATH = "${
rustToolchain.${pkgs.system}.rust-src
}/lib/rustlib/src/rust/library";
#LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs;
#LIBCLANG_PATH = "${llvmPackages.libclang.lib}/lib";
#BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${llvmPackages.libclang.lib}/lib/clang/${lib.getVersion clang}/include";
packages = with pkgs; [
pkg-config
llvmPackages.libclang
llvmPackages.libcxxClang
clang
# Use mold when we are runnning in Linux
(lib.optionals stdenv.isLinux mold)
udev alsa-lib vulkan-loader
xorg.libX11 xorg.libXcursor xorg.libXi xorg.libXrandr # To use the x11 feature
libxkbcommon wayland # To use the wayland feature
rustToolchain.${pkgs.system}.default
rust-analyzer-unwrapped
cargo
cmake
];
};
});
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
checks = eachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
};
}