Last active
October 12, 2022 21:06
-
-
Save tstachl/0db5a09921d5513c8d62c83b73550c30 to your computer and use it in GitHub Desktop.
This bash script enables GPG, Yubikey and SSH on a nixos live cd for my public key.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/run/current-system/sw/bin/sh | |
nix-env -iA nixos.git nixos.gnupg nixos.pinentry-curses | |
gpg --receive-keys DE749C31D060A160 | |
echo "$( \ | |
gpg --list-keys \ | |
| grep DE749C31D060A160 -A 1 \ | |
| head -1 | tr -d '[:space:]' \ | |
):6:" | gpg --import-ownertrust; | |
echo "pinentry-program $(which pinentry)" > ~/.gnupg/gpg-agent.conf | |
gpg-connect-agent reloadagent /bye | |
echo "export SSH_AUTH_SOCK=\$(gpgconf --list-dirs agent-ssh-socket)" >> ~/.bashrc | |
echo "export PINENTRY_USER_DATA=\"USE_CURSES=1\"" >> ~/.bashrc | |
echo "export GPG_TTY=\$(tty)" >> ~/.bashrc | |
source ~/.bashrc | |
gpg-connect-agent updatestartuptty /bye | |
echo "DONE." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment