From ad216be727c1833f87c395edac18483ff59e42a2 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Wed, 29 Apr 2026 11:44:16 +0300 Subject: [PATCH] Add secrets file --- .gitignore | 3 +++ early-init.el | 8 ++++---- lisp/icejam-agent-shell.el | 7 ++++--- lisp/icejam-base.el | 17 ++++------------- 4 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index a657fe2..5346d8e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,6 @@ ielm-history.eld # Ignore actual init as it can contain private data init.el + +# Ignore secrets +icejam-secrets.el diff --git a/early-init.el b/early-init.el index 4696078..3f11c3e 100644 --- a/early-init.el +++ b/early-init.el @@ -26,8 +26,8 @@ (time-subtract after-init-time before-init-time))) gcs-done))) -;; set path for native compilation to work -(setenv "PATH" "/Users/maciej/.local/share/zinit/polaris/bin:/Users/maciej/.asdf/shims:/Users/maciej/.local/bin:/Users/maciej/.opam/default/bin:/Users/maciej/.go/bin:/Users/maciej/.elan/bin:/opt/homebrew/opt/postgresql@17/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:/Users/maciej/.dotnet/tools:/Applications/Postgres.app/Contents/Versions/latest/bin:/Applications/kitty.app/Contents/MacOS") -(setq exec-path (split-string (getenv "PATH") path-separator)) - +;; Load secrets file before doing anything else: +(let ((secrets-file (concat user-emacs-directory "icejam-secrets.el"))) + (when (file-exists-p secrets-file) + (load secrets-file))) ;;; early-init.el ends here diff --git a/lisp/icejam-agent-shell.el b/lisp/icejam-agent-shell.el index f129cf9..df2cedd 100644 --- a/lisp/icejam-agent-shell.el +++ b/lisp/icejam-agent-shell.el @@ -10,6 +10,7 @@ ;;; Code: (declare-function agent-shell-make-environment-variables 'agent-shell) +(defvar icejam-variables-to-load-in-agent-shell '()) (use-package agent-shell :ensure t @@ -21,9 +22,9 @@ (setopt agent-shell-anthropic-claude-environment (agent-shell-make-environment-variables :inherit-env t)) (setopt agent-shell-opencode-environment - (agent-shell-make-environment-variables - :inherit-env t - "GOOGLE_CLOUD_PROJECT" "mv-ai-architecture")) + (apply #'agent-shell-make-environment-variables + :inherit-env t + icejam-variables-to-load-in-agent-shell)) (setopt agent-shell-opencode-default-model-id "google-vertex-anthropic/claude-sonnet-4-6@default")) diff --git a/lisp/icejam-base.el b/lisp/icejam-base.el index aebda6a..edc1652 100644 --- a/lisp/icejam-base.el +++ b/lisp/icejam-base.el @@ -110,6 +110,9 @@ (eval-when-compile (declare-function exec-path-from-shell-initialize 'exec-path-from-shell)) +;; This should be defined in secrets. +(defvar icejam-variables-to-load-from-shell '()) + ;; Allow to execute path from shell (use-package exec-path-from-shell ;; :if (memq window-system '(x mac ns)) @@ -118,19 +121,7 @@ :hook ((elpaca-after-init . exec-path-from-shell-initialize)) :config (add-to-list 'exec-path "/usr/local/bin") - (dolist (var '("DEFT_PATH" - "LANG" - "LC_CTYPE" - "CLAUDE_CODE_USE_VERTEX" - "CLOUD_ML_REGION" - "ANTHROPIC_VERTEX_PROJECT_ID" - "VERTEX_REGION_CLAUDE_3_5_HAIKU" - "VERTEX_REGION_CLAUDE_3_5_SONNET" - "VERTEX_REGION_CLAUDE_3_7_SONNET" - "VERTEX_REGION_CLAUDE_4_0_OPUS" - "VERTEX_REGION_CLAUDE_4_0_SONNET" - "VERTEX_REGION_CLAUDE_4_1_OPUS" - "ANTHROPIC_MODEL")) + (dolist (var icejam-variables-to-load-from-shell) (add-to-list 'exec-path-from-shell-variables var))) (use-package direnv :ensure t :defer t