xvmcmm/flake.nix

58 lines
1.7 KiB
Nix
Raw Normal View History

2024-06-04 13:41:33 +02:00
{
description = "A basic Rust devshell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, nixpkgs-unstable, rust-overlay, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlay-unstable = final: prev: {
unstable = import nixpkgs-unstable {
localSystem = { inherit system; };
};
};
overlays = [ (import rust-overlay) overlay-unstable ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
with pkgs;
{
devShells.default = mkShell {
buildInputs = [
trunk
dart-sass
unstable.rust-analyzer
llvmPackages.libclang
llvmPackages.lld
clang
cargo-generate
openssl
pkg-config
dap
(rust-bin.selectLatestNightlyWith (toolchain: toolchain.default.override {
extensions = [ "rust-src" "rust-analyzer" ];
targets = [ "wasm32-unknown-unknown" ];
}))
];
shellHook = ''
alias grep=ripgrep
export PATH=$PATH:''${CARGO_HOME:-~/.cargo}/bin
# export CC=clang
export CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER=lld
export LIBCLANG_PATH=${pkgs.llvmPackages.libclang.lib}/lib
export BINDGEN_EXTRA_CLANG_ARGS="-I ${pkgs.llvmPackages.libclang.lib}/lib/clang/16/include"
'';
};
}
);
}