This commit is contained in:
despiegk 2024-01-13 14:42:36 +03:00
parent 7579a52ff9
commit 7fe9b3fda1
Signed by: despiegk
GPG Key ID: 99E4E1492F73BC18
7 changed files with 192 additions and 1 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.mypy_cache
deluge_conf
bin/
code/
nuscripts
nuscripts/*

View File

@ -1,2 +1,24 @@
# crystaldev # my crystal development environment
- make sure nix is installed
```bash
#go to the cloned repo
#following will start your virtual shell
./start.sh
#then in the shell open the hero shell (based on nushell, will set all paths to make this dir sandboxed)
./hero_shell.sh
#if you want hero and mycelium do
herotools install_hero
#if you want mycelium
herotools install_mycelium
#install v & crystallib
herotools install_crystal
```

10
bash_shell.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
clear
export BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
export PATH=${BASE}/bin:${BASE}/v:${PATH}
cd ${BASE}
bash

105
hero_shell.sh Executable file
View File

@ -0,0 +1,105 @@
#!/bin/bash
set -e
clear
export BASE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
export NU_CONFIG_DIR=${BASE}/nuscripts/config
#keys used to see how to checkout code, don't remove
if [[ -z "$SSH_AUTH_SOCK" ]]; then
echo " - SSH agent is not running."
export sshkeys=''
else
export sshkeys=$(ssh-add -l)
fi
function gitcheck {
# Check if Git email is set
if [ -z "$(git config user.email)" ]; then
echo "Git email is not set."
read -p "Enter your Git email: " git_email
git config --global user.email "$git_email"
else
echo "Git email is set to: $(git config user.email)"
fi
}
function github_keyscan {
mkdir -p ~/.ssh
if ! grep github.com ~/.ssh/known_hosts > /dev/null
then
ssh-keyscan github.com >> ~/.ssh/known_hosts
fi
git config --global pull.rebase false
}
function nuscript_get {
gitcheck
github_keyscan
export DIR_CODE=$BASE/code
mkdir -p $DIR_CODE
if [[ -d "$DIR_CODE/nuscripts" ]]
then
echo
else
pushd $DIR_CODE 2>&1 >> /dev/null
if [[ -z "$sshkeys" ]]; then
git clone --depth 1 --no-single-branch https://git.ourworld.tf/despiegk/nuscripts.git
else
git clone --depth 1 --no-single-branch git@git.ourworld.tf:despiegk/nuscripts.git
fi
popd 2>&1 >> /dev/null
fi
rm -f $BASE/nuscripts
ln -s "$DIR_CODE/nuscripts" $BASE/nuscripts
}
# run_hero() {
# hero 2>&1 > /dev/null
# exit_status=$?
# if [ $exit_status -ne 0 ]; then
# echo "Failed to start Hero Cmd."
# echo "If you're on macOS and encountering security restrictions."
# echo "You can do this in System Preferences > Security & Privacy."
# echo "Under the Privacy tab, add the Terminal and other Apps from this Distro"
# echo "to the list of applications with Access."
# fi
# }
# run_nu() {
# nu -h 2>&1 > /dev/null
# exit_status=$?
# if [ $exit_status -ne 0 ]; then
# echo "Failed to start Nushell."
# fi
# }
# run_mycelium() {
# mycelium -h 2>&1 > /dev/null
# exit_status=$?
# if [ $exit_status -ne 0 ]; then
# echo "Failed to start Nushell."
# echo "If you're on macOS and encountering security restrictions."
# echo "You can do this in System Preferences > Security & Privacy."
# echo "Under the Privacy tab, add the Terminal and other Apps from this Distro"
# echo "to the list of applications with Access."
# fi
# }
# run_hero
# run_nu
# run_mycelium
cd ${BASE}
nuscript_get
nu --config nuscripts/config/config.nu --env-config nuscripts/config/env.nu -e 'source nuscripts/load.nu; $env.PATH = (paths_nix)'

10
push_code.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$MYDIR"
echo "Enter the commit message:"
read commit_message
git add . -A ; git commit -m "$commit_message"; git push

29
shell.nix Normal file
View File

@ -0,0 +1,29 @@
let
nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-23.11";
pkgs = import nixpkgs { config = {}; overlays = []; };
in
pkgs.mkShell {
packages = with pkgs; [
git
nushell
mc
jq
# vscode-with-extensions
# libtorrent-rasterbar
# python311Packages.libtorrent-rasterbar
python311Full
python311Packages.ipython
python311Packages.ipdb
python311Packages.rq
rsync
rustc
go
];
# shellHook = ''
# echo "Nix shell environment is ready."
# hero_shell.sh
# '';
}

9
start.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -e
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$MYDIR"
export NIXPKGS_ALLOW_UNFREE=1
nix-shell