dev-templates/rust-toolchain/flake.nix
2023-02-14 16:20:41 -08:00

46 lines
968 B
Nix

{
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 {
packages = with pkgs; [
rustToolchain
openssl
pkg-config
cargo-deny
cargo-edit
cargo-watch
rust-analyzer
];
shellHook = ''
${pkgs.rustToolchain}/bin/cargo --version
'';
};
});
}