commit f5f1be1e526bec8d5f83c597319d9f4260c007ec Author: voidarc Date: Wed Apr 1 14:13:04 2026 +0100 initial with rust diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e00084b --- /dev/null +++ b/flake.nix @@ -0,0 +1,14 @@ +{ + description = "A very basic flake"; + + outputs = + { self }: + { + templates = { + rust = { + path = ./rust-template; + description = "A standard Rust development environment"; + }; + }; + }; +} diff --git a/rust-template b/rust-template new file mode 100644 index 0000000..69c9a43 --- /dev/null +++ b/rust-template @@ -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 + ''; + }; + } + ); +}