Init: init rust template

This commit is contained in:
Kirill Samoylenkov 2025-11-17 19:27:28 +05:00
parent 35bc5ff0e8
commit 8845570dc3
2 changed files with 154 additions and 0 deletions

58
rust/flake.nix Normal file
View file

@ -0,0 +1,58 @@
{
description = "";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs {
inherit system overlays;
};
in
{
devShells.default =
with pkgs;
mkShell {
nativeBuildInput = with pkgs; [
(pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"cargo"
"rustc"
"rustfmt"
];
})
gcc
];
RUST_SRC_PATH = "${
pkgs.rust-bin.stable.latest.default.override {
extensions = [ "rust-src" ];
}
}/lib/rustlib/src/rust/library";
buildInputs = [
openssl.dev
glib.dev
pkg-config
rust-analyzer
rustfmt
];
};
}
);
}