[zsh] Move away from funky SSH key loading
This commit is contained in:
@ -454,45 +454,46 @@ Always open the result in `eww`."
|
|||||||
|
|
||||||
;; Bind globally to C-c l
|
;; Bind globally to C-c l
|
||||||
(global-set-key (kbd "C-c l") #'life-scrobble-url)
|
(global-set-key (kbd "C-c l") #'life-scrobble-url)
|
||||||
(after! magit
|
|
||||||
(defvar my/ssh-key-injector-script (expand-file-name "~/.local/bin/load_keys"))
|
|
||||||
|
|
||||||
(defun my/ssh-add-status ()
|
; (after! magit
|
||||||
(call-process "ssh-add" nil nil nil "-l"))
|
; (defvar my/ssh-key-injector-script (expand-file-name "~/.local/bin/load_keys"))
|
||||||
|
;
|
||||||
(defun my/run-ssh-key-injector ()
|
; (defun my/ssh-add-status ()
|
||||||
(my/apply-ssh-agent-env)
|
; (call-process "ssh-add" nil nil nil "-l"))
|
||||||
(let* ((buf (get-buffer-create "*ssh-key-injector*"))
|
;
|
||||||
(process-connection-type t)
|
; (defun my/run-ssh-key-injector ()
|
||||||
(process-environment (copy-sequence process-environment)))
|
; (my/apply-ssh-agent-env)
|
||||||
(unless (file-executable-p my/ssh-key-injector-script)
|
; (let* ((buf (get-buffer-create "*ssh-key-injector*"))
|
||||||
(user-error "SSH injector script not executable: %s" my/ssh-key-injector-script))
|
; (process-connection-type t)
|
||||||
(with-current-buffer buf
|
; (process-environment (copy-sequence process-environment)))
|
||||||
(erase-buffer)
|
; (unless (file-executable-p my/ssh-key-injector-script)
|
||||||
(insert (format "Emacs SSH_AUTH_SOCK=%s\n\n" (or (getenv "SSH_AUTH_SOCK") "<unset>"))))
|
; (user-error "SSH injector script not executable: %s" my/ssh-key-injector-script))
|
||||||
(let ((proc (make-process
|
; (with-current-buffer buf
|
||||||
:name "ssh-key-injector"
|
; (erase-buffer)
|
||||||
:buffer buf
|
; (insert (format "Emacs SSH_AUTH_SOCK=%s\n\n" (or (getenv "SSH_AUTH_SOCK") "<unset>"))))
|
||||||
:stderr buf
|
; (let ((proc (make-process
|
||||||
:command (list my/ssh-key-injector-script)
|
; :name "ssh-key-injector"
|
||||||
:noquery t)))
|
; :buffer buf
|
||||||
(while (process-live-p proc)
|
; :stderr buf
|
||||||
(accept-process-output proc 0.05))
|
; :command (list my/ssh-key-injector-script)
|
||||||
(unless (eq (process-exit-status proc) 0)
|
; :noquery t)))
|
||||||
(display-buffer buf)
|
; (while (process-live-p proc)
|
||||||
(user-error "SSH key injection failed. See *ssh-key-injector*.")))))
|
; (accept-process-output proc 0.05))
|
||||||
|
; (unless (eq (process-exit-status proc) 0)
|
||||||
(defun my/ensure-ssh-keys-loaded (&rest _ignore)
|
; (display-buffer buf)
|
||||||
(pcase (my/ssh-add-status)
|
; (user-error "SSH key injection failed. See *ssh-key-injector*.")))))
|
||||||
(0 nil)
|
;
|
||||||
(1 (my/run-ssh-key-injector))
|
; (defun my/ensure-ssh-keys-loaded (&rest _ignore)
|
||||||
(2 (user-error "No reachable ssh-agent (SSH_AUTH_SOCK=%s)"
|
; (pcase (my/ssh-add-status)
|
||||||
(or (getenv "SSH_AUTH_SOCK") "<unset>")))
|
; (0 nil)
|
||||||
(_ (my/run-ssh-key-injector))))
|
; (1 (my/run-ssh-key-injector))
|
||||||
|
; (2 (user-error "No reachable ssh-agent (SSH_AUTH_SOCK=%s)"
|
||||||
(dolist (fn '(magit-status magit-fetch magit-push magit-pull))
|
; (or (getenv "SSH_AUTH_SOCK") "<unset>")))
|
||||||
(advice-remove fn #'my/ensure-ssh-keys-loaded)
|
; (_ (my/run-ssh-key-injector))))
|
||||||
(advice-add fn :before #'my/ensure-ssh-keys-loaded)))
|
;
|
||||||
|
; (dolist (fn '(magit-status magit-fetch magit-push magit-pull))
|
||||||
|
; (advice-remove fn #'my/ensure-ssh-keys-loaded)
|
||||||
|
; (advice-add fn :before #'my/ensure-ssh-keys-loaded)))
|
||||||
|
|
||||||
(defun my/disable-apheleia-in-certain-projects ()
|
(defun my/disable-apheleia-in-certain-projects ()
|
||||||
(when-let ((root (and (fboundp 'project-root)
|
(when-let ((root (and (fboundp 'project-root)
|
||||||
|
|||||||
11
zsh/.zshrc
11
zsh/.zshrc
@ -3,14 +3,17 @@ export GOPATH="$HOME/.go"
|
|||||||
export PATH=$HOME/.bin:$HOME/var/bin:/usr/local/bin:$PATH:$HOME/.go/bin:$HOME/.local/bin
|
export PATH=$HOME/.bin:$HOME/var/bin:/usr/local/bin:$PATH:$HOME/.go/bin:$HOME/.local/bin
|
||||||
export GIT_CU_DIR="$HOME/src"
|
export GIT_CU_DIR="$HOME/src"
|
||||||
export ZSH="$HOME/.oh-my-zsh"
|
export ZSH="$HOME/.oh-my-zsh"
|
||||||
|
export GPG_TTY=$(tty)
|
||||||
|
|
||||||
|
export SSH_ASKPASS="$HOME/.local/bin/ssh-askpass-load-keys"
|
||||||
|
export SSH_ASKPASS_REQUIRE=force
|
||||||
|
|
||||||
|
#load_keys &>/dev/null
|
||||||
|
|
||||||
ZSH_THEME="robbyrussell"
|
ZSH_THEME="robbyrussell"
|
||||||
|
|
||||||
plugins=(git z fzf asdf direnv emacs yarn aws)
|
plugins=(git z fzf asdf direnv emacs yarn aws)
|
||||||
|
|
||||||
eval "$($HOME/.local/bin/ssh-agent-env)"
|
|
||||||
load_keys &>/dev/null
|
|
||||||
|
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
create_email() {
|
create_email() {
|
||||||
@ -61,10 +64,8 @@ esac
|
|||||||
[[ -d "/home/linuxbrew/.linuxbrew/bin" ]] && export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
|
[[ -d "/home/linuxbrew/.linuxbrew/bin" ]] && export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
|
||||||
|
|
||||||
eval "$(direnv hook /bin/zsh)"
|
eval "$(direnv hook /bin/zsh)"
|
||||||
export GPG_TTY=$(tty)
|
|
||||||
|
|
||||||
. ${ASDF_DATA_DIR:-$HOME/.asdf}/plugins/golang/set-env.zsh &>/dev/null
|
. ${ASDF_DATA_DIR:-$HOME/.asdf}/plugins/golang/set-env.zsh &>/dev/null
|
||||||
load_keys &>/dev/null
|
|
||||||
|
|
||||||
# opencode
|
# opencode
|
||||||
[[ -d "$HOME/.npm-global" ]] && export PATH="$HOME/.npm-global/bin":$PATH
|
[[ -d "$HOME/.npm-global" ]] && export PATH="$HOME/.npm-global/bin":$PATH
|
||||||
|
|||||||
Reference in New Issue
Block a user