From 8501fe3953defb755ba60ce398413b0c8c503a57 Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Thu, 29 Aug 2024 19:12:55 +0200 Subject: Auth, don't use doom pass setup --- config/doom/config.org | 62 +++++++++++++++++++++++++++++++------------------- config/doom/init.el | 2 +- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/config/doom/config.org b/config/doom/config.org index a96f8ac..7ec1cd9 100644 --- a/config/doom/config.org +++ b/config/doom/config.org @@ -36,15 +36,6 @@ (abbreviate-file-name (buffer-file-name)) "%b")))) #+END_SRC -** Keybindings -#+begin_src emacs-lisp -(map! :leader - :desc "M-x" "x" #'execute-extended-command - ) -(after! evil - (setq evil-default-state 'emacs) - (set-evil-initial-state! '(prog-mode text-mode fundamental-mode conf-mode pass-view-mode) 'normal)) -#+end_src ** Package Manager Doom manages packages separately. Keep that file separate #+begin_src emacs-lisp :tangle "packages.el" @@ -55,6 +46,35 @@ Doom manages packages separately. Keep that file separate #+begin_src emacs-lisp (setenv "SSH_AUTH_SOCK" (concat (getenv "XDG_RUNTIME_DIR")"/gnupg/S.gpg-agent.ssh")) #+end_src +** Auth mechanisms +#+begin_src emacs-lisp :tangle "packages.el" +(package! pass) +(package! password-store) +(package! password-store-otp) +#+end_src + +#+begin_src emacs-lisp +(use-package! pass + :init + (require 'auth-source) + (auth-source-pass-enable) + (defun on/fetch-password (&rest params) + (if-let* ((match (car (apply #'auth-source-search params))) + (secret (plist-get match :secret))) + (if (functionp secret) + (funcall secret) + secret) + (user-error "Password not found for %S" params)))) +#+end_src +** Keybindings +#+begin_src emacs-lisp +;; (map! :leader +;; :desc "M-x" "x" #'execute-extended-command +;; ) +(after! evil + (setq evil-default-state 'emacs) + (set-evil-initial-state! '(prog-mode text-mode fundamental-mode conf-mode pass-view-mode) 'normal)) +#+end_src ** Avy This allows me to jump to buffer positions using my home row ordering #+begin_src emacs-lisp @@ -522,17 +542,16 @@ this new window. #+end_src * IRC #+begin_src emacs-lisp -(set-irc-server! "irc.libera.chat" - `(:tls t - :port 6697 - :nick "titan-c" - :sasl-username ,(+pass-get-user "Social/freenode/titan-c") - :sasl-password (lambda (&rest _) (+pass-get-secret "Social/freenode/titan-c")) - :channels ("#emacs" "#guix"))) +(after! circe + (set-irc-server! "irc.libera.chat" + '(:tls t + :port 6697 + :nick "titan-c" + :sasl-username "titan-c" + :sasl-password (lambda (&rest _) (on/fetch-password :user "titan-c" :host "freenode")) + :channels ("#emacs" "#guix")))) #+end_src -#+RESULTS: - * Ledger Emacs mode for managing ledger text files #+BEGIN_SRC emacs-lisp @@ -793,15 +812,12 @@ skills: (user "crazy") (port (plist-get networks (intern (completing-read "Pick network: " networks)))) - (secret (-some-> - (auth-source-search :host host) - (car) - (plist-get :secret)))) + (secret (on/fetch-password :host host))) (when (and btc-explorer-bitcoind (json-rpc-live-p btc-explorer-bitcoind)) (json-rpc-close btc-explorer-bitcoind)) (setq btc-explorer-bitcoind - (json-rpc-connect host port user (funcall secret)))))) + (json-rpc-connect host port user secret))))) (use-package! lnd :load-path "~/dev/emacs-lisp/btc-explorer/" diff --git a/config/doom/init.el b/config/doom/init.el index a568d08..7394840 100644 --- a/config/doom/init.el +++ b/config/doom/init.el @@ -99,7 +99,7 @@ lsp magit ; a git porcelain for Emacs ;;make ; run make tasks from Emacs - (pass +auth) ; password manager for nerds + ;; (pass +auth) ; password manager for nerds pdf ; pdf enhancements ;;prodigy ; FIXME managing external services & code builders ;;rgb ; creating color strings -- cgit v1.2.3