33 lines
No EOL
890 B
Bash
Executable file
33 lines
No EOL
890 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
sudo mkdir /nix/var/nix/profiles/per-user/albert
|
|
pushd /etc/nixos/git
|
|
home-manager switch -b backup --flake .
|
|
source ~/.bashrc
|
|
|
|
# Import and trust the GPG key
|
|
read -p "Path to GPG Private Key: " gpgKey
|
|
gpg --import $gpgKey
|
|
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key 64F6C4EB46C4543A trust
|
|
|
|
# Setup SOPS
|
|
ssh-to-pgp -i /etc/ssh/ssh_host_rsa_key -o /etc/nixos/git/keys/hosts/$(hostname).asc
|
|
# Update your .sops.yaml with this key
|
|
sops-update secrets/secrets.yaml
|
|
for i in $(ls secrets/):
|
|
|
|
# Set 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
|
|
git add keys/hosts/`hostname`.asc
|
|
git commit -am "Setup: `whoami`@`hostname`"
|
|
git push
|
|
|
|
popd
|
|
echo
|
|
echo
|
|
echo "Complete." |