dev-templates/rust-toolchain/flake.nix

46 lines
977 B
Nix
Raw Normal View History

2022-10-20 07:14:56 -07:00
{
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
2022-10-27 17:45:13 -07:00
cargo-watch
2022-10-20 07:14:56 -07:00
rust-analyzer
2022-10-27 17:45:13 -07:00
];
2022-10-20 07:14:56 -07:00
shellHook = ''
${pkgs.rustToolchain}/bin/cargo --version
'';
};
});
}