From ba364b8195860abbef0e94a3c684e9e78a36db9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20R=C3=B6ger?= Date: Sun, 16 Mar 2025 18:24:13 +0100 Subject: [PATCH] fix rust template --- templates/rust/Cargo.toml | 4 ++-- templates/rust/flake.nix | 7 ++++--- templates/rust/rust-toolchain.toml | 2 +- templates/rust/src/main.rs | 10 +--------- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/templates/rust/Cargo.toml b/templates/rust/Cargo.toml index aad94b0..9322e5e 100644 --- a/templates/rust/Cargo.toml +++ b/templates/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "RustBinary" -description = "A rust binary" +name = "hello" +description = "A test rust binary" publish = false version = "0.1.0" diff --git a/templates/rust/flake.nix b/templates/rust/flake.nix index 79a1bee..2d1b81a 100644 --- a/templates/rust/flake.nix +++ b/templates/rust/flake.nix @@ -1,8 +1,8 @@ { - description = "Rust-Nix"; + description = "Rust-Hello"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; @@ -32,7 +32,7 @@ # Use rust-bin to generate the toolchain from rust-toolchain.toml rust-toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; - buildRustCrateForPkgs = pkgs: + buildRustCrateForPkgs = _: pkgs.buildRustCrate.override { rustc = rust-toolchain; # Use rustc from toolchain cargo = rust-toolchain; # Use cargo from toolchain @@ -52,6 +52,7 @@ hello = cargoNix.rootCrate.build; default = hello; }; + devShell = pkgs.mkShell { buildInputs = [rust-toolchain]; }; diff --git a/templates/rust/rust-toolchain.toml b/templates/rust/rust-toolchain.toml index 58e81e8..535db1f 100644 --- a/templates/rust/rust-toolchain.toml +++ b/templates/rust/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "1.80.1" +channel = "1.85.0" components = [ "rustfmt", "rustc-dev", "rust-analyzer", "rust-src"] diff --git a/templates/rust/src/main.rs b/templates/rust/src/main.rs index ed43722..ea5b5d8 100644 --- a/templates/rust/src/main.rs +++ b/templates/rust/src/main.rs @@ -1,11 +1,3 @@ -use colored::*; - fn main() { - println!("{}", "Hello, world!".red()); - println!("{}", "Hello, world!".green()); - println!("{}", "Hello, world!".yellow()); - println!("{}", "Hello, world!".blue()); - println!("{}", "Hello, world!".purple()); - println!("{}", "Hello, world!".cyan()); - println!("{}", "Hello, world!".white()); + println!("{}", "Hello, world!"); }