Add rust-toolchain template
This commit is contained in:
parent
c4a5d837e4
commit
20b5b176c1
28 changed files with 221 additions and 73 deletions
44
rust-toolchain/flake.nix
Normal file
44
rust-toolchain/flake.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
description = "A Nix-flake-based Rust development environment";
|
||||
|
||||
inputs = {
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
, flake-utils
|
||||
, nixpkgs
|
||||
, rust-overlay
|
||||
}:
|
||||
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
(self: super: {
|
||||
rustToolchain = super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
})
|
||||
];
|
||||
|
||||
pkgs = import nixpkgs { inherit system overlays; };
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
rustToolchain
|
||||
openssl
|
||||
pkg-config
|
||||
cargo-deny
|
||||
cargo-edit
|
||||
rust-analyzer
|
||||
] ++ pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ cargo-watch ]); # Currently broken on macOS
|
||||
|
||||
shellHook = ''
|
||||
${pkgs.rustToolchain}/bin/cargo --version
|
||||
'';
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue