post-install
This commit is contained in:
parent
4688ce4145
commit
6337ef3ece
1 changed files with 11 additions and 6 deletions
|
@ -1,15 +1,16 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
# Home-Manager Setup
|
||||||
|
echo "Setting up Home Manager..... "
|
||||||
sudo mkdir /nix/var/nix/profiles/per-user/albert
|
sudo mkdir /nix/var/nix/profiles/per-user/albert
|
||||||
pushd /etc/nixos/git
|
pushd /etc/nixos/git
|
||||||
home-manager switch -b backup --flake /etc/nixos/git
|
home-manager switch -b backup --flake /etc/nixos/git
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
# Import and trust the GPG key
|
# Import and trust the GPG key
|
||||||
echo "Setting up user 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 mkdir /tmp/drive
|
||||||
sudo cryptsetup luksOpen /dev/${drive}3 usb-luks
|
sudo cryptsetup luksOpen /dev/${drive}3 usb-luks
|
||||||
sudo mount /dev/mapper/usb-luks /tmp/drive
|
sudo mount /dev/mapper/usb-luks /tmp/drive
|
||||||
|
@ -19,13 +20,12 @@ sudo rmdir /tmp/drive
|
||||||
sudo cryptsetup luksClose /dev/mapper/usb-luks
|
sudo cryptsetup luksClose /dev/mapper/usb-luks
|
||||||
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key albert@sysctl.io trust
|
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key albert@sysctl.io trust
|
||||||
|
|
||||||
sleep 10
|
|
||||||
|
|
||||||
# Setup SOPS
|
# Setup SOPS
|
||||||
|
echo "Setting up SOPS keys..... "
|
||||||
echo "!!!!!"
|
echo "!!!!!"
|
||||||
echo "!!!!!"
|
echo "!!!!!"
|
||||||
echo "!!!!!"
|
echo "!!!!!"
|
||||||
echo "!!!!! Copy this key to .sops.yaml: "
|
echo "!!!!! Copy this signature to .sops.yaml: "
|
||||||
echo "!!!!!"
|
echo "!!!!!"
|
||||||
echo "!!!!!"
|
echo "!!!!!"
|
||||||
echo "!!!!!"
|
echo "!!!!!"
|
||||||
|
@ -36,17 +36,20 @@ sudo ssh-to-pgp \
|
||||||
-o /etc/nixos/git/keys/hosts/$(hostname).asc
|
-o /etc/nixos/git/keys/hosts/$(hostname).asc
|
||||||
|
|
||||||
# Set up ssh keys
|
# Set up ssh keys
|
||||||
|
echo "Setting up SSH Keys..... "
|
||||||
ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa -N ""
|
ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa -N ""
|
||||||
echo "" >> ./keys/ssh/keys.txt
|
echo "" >> ./keys/ssh/keys.txt
|
||||||
echo "# `whoami`@`hostname`" >> ./keys/ssh/keys.txt
|
echo "# `whoami`@`hostname`" >> ./keys/ssh/keys.txt
|
||||||
cat /home/albert/.ssh/id_rsa.pub >> ./keys/ssh/keys.txt
|
cat /home/albert/.ssh/id_rsa.pub >> ./keys/ssh/keys.txt
|
||||||
|
|
||||||
# Add all changes to git and and push
|
# Add all changes to git and and push
|
||||||
|
echo "Pushing to git..... "
|
||||||
git add keys/hosts/`hostname`.asc
|
git add keys/hosts/`hostname`.asc
|
||||||
git commit -am "Setup: `whoami`@`hostname`"
|
git commit -am "Setup: `whoami`@`hostname`"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
# Fix gnupg permissions:
|
# Fix gnupg permissions:
|
||||||
|
echo "Fixing ~/.gnupg permissions..... "
|
||||||
find ~/.gnupg -type f -exec chmod 600 {} \;
|
find ~/.gnupg -type f -exec chmod 600 {} \;
|
||||||
find ~/.gnupg -type d -exec chmod 700 {} \;
|
find ~/.gnupg -type d -exec chmod 700 {} \;
|
||||||
|
|
||||||
|
@ -55,5 +58,7 @@ echo
|
||||||
echo "Complete. Once '.sops.yaml' is updated, "
|
echo "Complete. Once '.sops.yaml' is updated, "
|
||||||
echo "you may run 'update-secrets'"
|
echo "you may run 'update-secrets'"
|
||||||
echo "and reboot."
|
echo "and reboot."
|
||||||
|
echo
|
||||||
|
echo "Reminder: Upload these changes to git"
|
||||||
|
|
||||||
popd
|
popd
|
Loading…
Reference in a new issue