initial with rust
This commit is contained in:
14
flake.nix
Normal file
14
flake.nix
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
description = "A very basic flake";
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{ self }:
|
||||||
|
{
|
||||||
|
templates = {
|
||||||
|
rust = {
|
||||||
|
path = ./rust-template;
|
||||||
|
description = "A standard Rust development environment";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
50
rust-template
Normal file
50
rust-template
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
{
|
||||||
|
description = "A simple Rust development environment";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
utils.url = "github:numtide/flake-utils";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs =
|
||||||
|
{
|
||||||
|
self,
|
||||||
|
nixpkgs,
|
||||||
|
utils,
|
||||||
|
}:
|
||||||
|
utils.lib.eachDefaultSystem (
|
||||||
|
system:
|
||||||
|
let
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
|
||||||
|
name = "rustshell";
|
||||||
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
# Rust toolchain
|
||||||
|
rustc
|
||||||
|
cargo
|
||||||
|
rustfmt
|
||||||
|
clippy
|
||||||
|
rust-analyzer
|
||||||
|
|
||||||
|
# Common dependencies for Rust crates
|
||||||
|
pkg-config
|
||||||
|
openssl
|
||||||
|
];
|
||||||
|
|
||||||
|
# Environment variables
|
||||||
|
shellHook = ''
|
||||||
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
|
# Trigger zsh if not already in it
|
||||||
|
if [[ -z "$ZSH_VERSION" ]]; then
|
||||||
|
exec zsh
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user