-
Notifications
You must be signed in to change notification settings - Fork 1
/
shell.nix
48 lines (41 loc) · 1.37 KB
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ pkgs ? import <nixpkgs> {} }:
let
rustOverlay = builtins.fetchTarball "https://github.com/oxalica/rust-overlay/archive/master.tar.gz";
pkgs = import <nixpkgs> {
overlays = [
(import rustOverlay)
];
};
rustVersion = "1.82.0";
# List of extra tools
toolList = with pkgs; [
rust-analyzer
cargo-expand
cargo-watch
cargo-outdated
];
# Function to get the name of a derivation
getName = drv: drv.pname or drv.name or "unknown";
# Generate the tool list string
toolListString = builtins.concatStringsSep "\n - " (map getName toolList);
in
pkgs.mkShell {
buildInputs = with pkgs; [
(rust-bin.stable.${rustVersion}.default.override {
extensions = [ "rust-src" ];
})
] ++ toolList;
shellHook = ''
# Welcome message
printf "\n\033[1;34m=============================================\033[0m"
printf "\n\033[1;32m🦀 Rust Development Environment Activated 🦀\033[0m"
printf "\n\033[1;34m=============================================\033[0m"
printf "\n\033[1;33m• Rust Version: ${rustVersion}\033[0m"
printf "\n\033[1;33m• Available Tools:\033[0m"
printf "\n - ${toolListString}"
source scripts.sh
printf "\n\033[1;34m=============================================\033[0m"
printf "\n\033[1;33m• Checking for any outdated packages...\033[0m\n"
cargo outdated --root-deps-only
'';
}