From 6337ef3ece35c1e69e5ec0b0ac0f8ba077bffa00 Mon Sep 17 00:00:00 2001 From: iFargle Date: Sat, 23 Sep 2023 22:13:49 +0900 Subject: [PATCH] post-install --- docs/setup.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/setup.sh b/docs/setup.sh index f21fedbe..ead570f9 100755 --- a/docs/setup.sh +++ b/docs/setup.sh @@ -1,15 +1,16 @@ #!/usr/bin/env bash + +# Home-Manager Setup +echo "Setting up Home Manager..... " sudo mkdir /nix/var/nix/profiles/per-user/albert pushd /etc/nixos/git home-manager switch -b backup --flake /etc/nixos/git source ~/.bashrc -sleep 10 - # Import and trust the GPG key echo "Setting up user GPG key..... " -drive=$(lsblk -o serial,name | grep -A 012345679518 | awk {'print $2'}) +drive=$(lsblk -o serial,name | grep 012345679518 | awk {'print $2'}) sudo mkdir /tmp/drive sudo cryptsetup luksOpen /dev/${drive}3 usb-luks sudo mount /dev/mapper/usb-luks /tmp/drive @@ -19,13 +20,12 @@ sudo rmdir /tmp/drive sudo cryptsetup luksClose /dev/mapper/usb-luks echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key albert@sysctl.io trust -sleep 10 - # Setup SOPS +echo "Setting up SOPS keys..... " echo "!!!!!" echo "!!!!!" echo "!!!!!" -echo "!!!!! Copy this key to .sops.yaml: " +echo "!!!!! Copy this signature to .sops.yaml: " echo "!!!!!" echo "!!!!!" echo "!!!!!" @@ -36,17 +36,20 @@ sudo ssh-to-pgp \ -o /etc/nixos/git/keys/hosts/$(hostname).asc # Set up ssh keys +echo "Setting up SSH Keys..... " ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa -N "" echo "" >> ./keys/ssh/keys.txt echo "# `whoami`@`hostname`" >> ./keys/ssh/keys.txt cat /home/albert/.ssh/id_rsa.pub >> ./keys/ssh/keys.txt # Add all changes to git and and push +echo "Pushing to git..... " git add keys/hosts/`hostname`.asc git commit -am "Setup: `whoami`@`hostname`" git push # Fix gnupg permissions: +echo "Fixing ~/.gnupg permissions..... " find ~/.gnupg -type f -exec chmod 600 {} \; find ~/.gnupg -type d -exec chmod 700 {} \; @@ -55,5 +58,7 @@ echo echo "Complete. Once '.sops.yaml' is updated, " echo "you may run 'update-secrets'" echo "and reboot." +echo +echo "Reminder: Upload these changes to git" popd \ No newline at end of file