Skip to content

Instantly share code, notes, and snippets.

@randallb
Last active June 20, 2022 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save randallb/2248c7ae0026ee755c6664433c2f4665 to your computer and use it in GitHub Desktop.
Save randallb/2248c7ae0026ee755c6664433c2f4665 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
FILE=/tmp/continue_init.sh
NIX_INSTALLER=install_nix.sh
if [ -f "$FILE" ]; then
echo "$FILE exists... so we'll continue from where we left off."
rm $FILE
rm $NIX_INSTALLER
mkdir -p ~/.ssh
cd ~/.ssh
ssh-keygen -K
# github=SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
# ssh-keyscan github.com >> githubKey
# read bit githubkey host <<< $(ssh-keygen -lf githubKey)
# if [ "$githubkey" != "$github" ]
# then
# echo "The GitHub fingerprint is incorrect"
# exit 1
# fi
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" | tee -a ~/.ssh/known_hosts
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_ed25519_sk_rk' git clone git@github.com:randallb/rbcode.git ~/rbcode
cd ~/rbcode/config
# ./continue.sh
else
echo "$FILE does not exist, so we must be kicking things off."
curl -L https://nixos.org/nix/install -o $NIX_INSTALLER
chmod +x $NIX_INSTALLER
if ./$NIX_INSTALLER; then
echo "cd $PWD; nix-shell -p openssh git --run $PWD/init_rbcode.sh" > $FILE
chmod +x $FILE
mkdir -p ~/.config/nix/
echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf
echo "open a new terminal and run"
echo "$FILE"
echo "to continue installing"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment