2024-07-26 22:30:35 +08:00
|
|
|
{
|
|
|
|
description = "Rust development environment with Clang and LLVM support";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs { inherit system; };
|
|
|
|
libPath = pkgs.lib.makeLibraryPath [
|
|
|
|
# load external libraries that you need in your rust project here
|
2024-07-26 23:22:00 +08:00
|
|
|
"."
|
2024-07-26 22:30:35 +08:00
|
|
|
];
|
|
|
|
in {
|
|
|
|
devShell = pkgs.mkShell {
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
llvmPackages_16.bintools
|
|
|
|
llvmPackages_16.libllvm
|
|
|
|
llvmPackages_16.llvm
|
|
|
|
llvmPackages_16.stdenv
|
|
|
|
rocmPackages.llvm.polly
|
|
|
|
clang
|
|
|
|
rustup
|
|
|
|
glib
|
|
|
|
gcc
|
|
|
|
libxml2
|
|
|
|
(with pkgsCross.riscv64; [ glib.stdenv.cc buildPackages.gdb ])
|
|
|
|
qemu
|
|
|
|
];
|
|
|
|
|
|
|
|
LD_LIBRARY_PATH = libPath;
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
|
|
|
|
export PATH=$PATH:''${RUSTUP_HOME:-~/.rustup}/toolchains/$RUSTC_VERSION-x86_64-unknown-linux-gnu/bin/
|
|
|
|
'';
|
|
|
|
|
|
|
|
# LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.llvmPackages_latest.libclang.lib ];
|
|
|
|
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|