Added a nix-shell template and a rust dev shell

This commit is contained in:
2024-04-18 23:27:33 +01:00
parent 7355932519
commit a64620aaf7
2 changed files with 50 additions and 0 deletions

29
nix-shells/rust.nix Normal file
View File

@@ -0,0 +1,29 @@
# Rust development.
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/master";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
# Rust packages
rustc
cargo
# Shell utils
strace
wget
curl
];
shellHook = ''
echo
PS1='\n\[\e[2m\][RUST]\[\e[0m\] \[\e[1m\]\w\[\e[0m\] \[\e[3m\]$(git branch --show-current 2>/dev/null)\n\[\e[0m\]\$ '
echo -e "\e[31m[NIX-SHELL RUST DEVELOPMENT ENVIRONMENT] \e[0m"
echo -ne "\e[1mVersion: \e[0m"
rustc --version
echo -ne " "
cargo --version
'';
}

21
nix-shells/template.nix Normal file
View File

@@ -0,0 +1,21 @@
# https://nix.dev/tutorials/declarative-and-reproducible-developer-environments
let
# nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/master";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShellNoCC {
packages = with pkgs; [
cowsay
lolcat
];
# Environment Variables
GREETING = "Hello, Nix!";
# Startup command
shellHook = ''
echo $GREETING | cowsay | lolcat
'';
}