aboutsummaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
Diffstat (limited to 'public')
-rwxr-xr-xpublic/nixos/setup.sh96
1 files changed, 70 insertions, 26 deletions
diff --git a/public/nixos/setup.sh b/public/nixos/setup.sh
index f659721..64962fd 100755
--- a/public/nixos/setup.sh
+++ b/public/nixos/setup.sh
@@ -79,32 +79,76 @@ start_nextcloud() {
green "Done."
}
+configure_git_annex() {
+ yellow "Setting up Git Annex repository..."
+ git clone "gcrypt::$HOME/Nextcloud/annex.git" "$HOME/annex/"
+ pushd ~/annex/
+ read -r -p "What's the description of the local Git Annex repository? " DESCRIPTION
+ git config --global user.email "eu@euandre.org"
+ git config --global user.name "EuAndreh"
+ git annex describe here "${DESCRIPTION}"
+
+ git annex enableremote nextcloud
+ git annex enableremote s3
+ # FIXME: rsyncnet
+ # git annex enableremote hd
+ # gitlab
+ # rsyncnet
+
+ git annex upgrade
+ git annex sync
+ popd
+ green "Done."
+}
+
+configure_dotfiles() {
+ yellow "Setting up temporary SSH configuration and dotfiles repository..."
+ mkdir -p ~/.ssh
+ cp ~/annex/secret/SSH/id_rsa.pub.txt ~/.ssh/id_rsa.pub
+ cp ~/annex/secret/SSH/id_rsa.txt ~/.ssh/id_rsa
+ chmod 600 ~/.ssh/id_rsa
+ blue "Open up the password manager to decrypt the SSH private key"
+ read -p "A prompt for the SSH password will appear! (Press any key to continue)" -n 1 -r
+
+ # FIXME: Is there an easier way?
+ export SSH_ENV="$HOME/.ssh/environment"
+ echo "Initialising new SSH agent..."
+ ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
+ echo succeeded
+ chmod 600 "${SSH_ENV}"
+ . "${SSH_ENV}" > /dev/null
+ ssh-add
+ # FIXME: Is there an easier way?
+
+ mkdir -p ~/dev/libre/
+ git clone git@git.sr.ht:~euandreh/dotfiles ~/dev/libre/dotfiles/
+ pushd ~/dev/libre/dotfiles/
+ git crypt unlock
+ popd
+ pushd ~/
+ source ~/dev/libre/dotfiles/bash/bashrc.sh
+ popd
+
+ read -p "A prompt for the sudo password password will appear for the NixOS symlinks! (Press any key to continue)" -n 1 -r
+ sudo ln -fs ~/dev/libre/dotfiles/nixos/configuration.nix /etc/nixos/configuration.nix
+ # sudo create symlink for /etc/nixos/configuration.nix and /etc/nixos/local-configuration.nix
+ green "Done."
+}
+
+restore_backups() {
+ # rsync
+ # borg serve
+
+ # restore mbsync from backup
+ # restore notmuch from backup
+ # restore newsboat from backup
+ # restore archive from backup
+}
+
import_gpg
start_nextcloud
+setup_git_annex
+setup_dotfiles
+restore_backups
-# download git annex from Nextcloud
-# wait for Nextcloud to finish sync
-# git annex enable
-# git annex describe
-# get annex &
-# download dotfiles
-# mr checkout &
-# wait
-# restore mbsync from backup
-# restore notmuch from backup
-# restore newsboat from backup
-# restore archive from backup
-# open emacs # eval x
-# sudo create symlink for /etc/nixos/configuration.nix and /etc/nixos/local-configuration.nix
-
-
-# *** 5. Clone annex repo from HD and setup remotes
-# #+BEGIN_SRC shell
-# git clone gcrypt::/media/andreh/UTCLOUD/annex.git
-# cd annex
-# git annex describe here "repo description"
-# git annex enableremote hd
-# git annex enableremote gitlab
-# git annex enableremote rsyncnet
-# git annex enableremote s3
-# #+END_SRC
+green "All done!"