add rust_environment
This commit is contained in:
parent
eb17946c21
commit
ee563bb987
1 changed files with 30 additions and 0 deletions
30
rust_environment/shell.nix
Normal file
30
rust_environment/shell.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
pkgs.mkShell {
|
||||
NIX_ENFORCE_PURITY=0;
|
||||
buildInputs = with pkgs; [
|
||||
cargo
|
||||
rustc
|
||||
];
|
||||
shellHook = ''
|
||||
function log_header {
|
||||
echo -ne "==> \e[32m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log_subheader {
|
||||
echo -ne "--> \e[33m\e[1m$1\e[0m\n\n"
|
||||
}
|
||||
function log {
|
||||
echo -ne " $1\n"
|
||||
}
|
||||
|
||||
echo ""
|
||||
log_header "rust_environment"
|
||||
if [ -s Cargo.toml ]; then
|
||||
log_subheader "found Cargo.toml, running 'cargo-build'"
|
||||
cargo build
|
||||
echo ""
|
||||
fi
|
||||
log_header "package versions"
|
||||
log "$(rustc --version)"
|
||||
log "$(cargo --version)"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue