refactor config for multi-machine support
Move gptel backend configuration to config-local.el (gitignored) so each machine can have its own LLM setup. Add config-local.example.el as a template with options for Ollama, remote llama.cpp, and local llama.cpp. Also make OS-specific paths portable: - Use ~ instead of hardcoded /Users/willem for elixir-ls - Wrap macOS TeX path in system-type conditional 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
435fcab6d7
commit
236c0e1c4f
@@ -1,3 +1,4 @@
|
|||||||
/README.tex
|
/README.tex
|
||||||
custom.el
|
custom.el
|
||||||
flycheck*
|
flycheck*
|
||||||
|
config-local.el
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
;;; config-local.example.el --- Template for machine-specific config -*- lexical-binding: t; -*-
|
||||||
|
;;
|
||||||
|
;; Copy this file to config-local.el and uncomment/modify the section for your setup.
|
||||||
|
;; config-local.el is gitignored, so each machine can have its own configuration.
|
||||||
|
|
||||||
|
;;; ============================================================================
|
||||||
|
;;; OPTION 1: Linux with Ollama (local models)
|
||||||
|
;;; ============================================================================
|
||||||
|
|
||||||
|
;; (setq gptel-backend (gptel-make-ollama "Ollama"
|
||||||
|
;; :host "localhost:11434"
|
||||||
|
;; :stream t
|
||||||
|
;; :models '(qwen2.5-coder:7b
|
||||||
|
;; qwen3:32b
|
||||||
|
;; llama3.2:latest))
|
||||||
|
;; gptel-model 'qwen2.5-coder:7b)
|
||||||
|
;;
|
||||||
|
;; (setq-default gptel-model 'qwen2.5-coder:7b)
|
||||||
|
;;
|
||||||
|
;; (gptel-make-preset 'explain
|
||||||
|
;; :system "Explain what this code does to a novice programmer."
|
||||||
|
;; :model 'qwen2.5-coder:7b
|
||||||
|
;; :backend "Ollama")
|
||||||
|
|
||||||
|
;;; ============================================================================
|
||||||
|
;;; OPTION 2: macOS connecting to remote Linux server
|
||||||
|
;;; ============================================================================
|
||||||
|
|
||||||
|
;; (setq gptel-backend (gptel-make-openai "remote-llama"
|
||||||
|
;; :host "linux-server.local:8000" ; your server's hostname
|
||||||
|
;; :protocol "http"
|
||||||
|
;; :stream t
|
||||||
|
;; :models '(Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf))
|
||||||
|
;; gptel-model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf)
|
||||||
|
;;
|
||||||
|
;; (setq-default gptel-model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf)
|
||||||
|
;;
|
||||||
|
;; (gptel-make-preset 'explain
|
||||||
|
;; :system "Explain what this code does to a novice programmer."
|
||||||
|
;; :model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf
|
||||||
|
;; :backend "remote-llama")
|
||||||
|
|
||||||
|
;;; ============================================================================
|
||||||
|
;;; OPTION 3: Linux with local llama.cpp server
|
||||||
|
;;; ============================================================================
|
||||||
|
|
||||||
|
;; (setq gptel-backend (gptel-make-openai "llama.cpp"
|
||||||
|
;; :host "localhost:8000"
|
||||||
|
;; :protocol "http"
|
||||||
|
;; :stream t
|
||||||
|
;; :models '(Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf))
|
||||||
|
;; gptel-model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf)
|
||||||
|
;;
|
||||||
|
;; (setq-default gptel-model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf)
|
||||||
|
;;
|
||||||
|
;; ;; Also add Ollama as secondary backend
|
||||||
|
;; (gptel-make-ollama "Ollama"
|
||||||
|
;; :host "localhost:11434"
|
||||||
|
;; :stream t
|
||||||
|
;; :models '(qwen2.5-coder:7b qwen3:0.6B))
|
||||||
|
;;
|
||||||
|
;; (gptel-make-preset 'explain
|
||||||
|
;; :system "Explain what this code does to a novice programmer."
|
||||||
|
;; :model 'Qwen3-Coder-30B-A3B-Instruct-Q6_K.gguf
|
||||||
|
;; :backend "llama.cpp")
|
||||||
|
;;
|
||||||
|
;; (gptel-make-preset 'elixir
|
||||||
|
;; :system "You are an expert programmer, specialising in Elixir and TDD, you live in Emacs"
|
||||||
|
;; :model 'Qwen3-Coder-30B-A3B-Instruct-Q6_K.gguf
|
||||||
|
;; :backend "llama.cpp")
|
||||||
|
|
||||||
|
;;; config-local.example.el ends here
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
)
|
)
|
||||||
|
|
||||||
(with-eval-after-load 'eglot
|
(with-eval-after-load 'eglot
|
||||||
(add-to-list 'eglot-server-programs '(elixir-ts-mode . ("sh" "/Users/willem/.elixir-ls/release/language_server.sh" ))))
|
(add-to-list 'eglot-server-programs '(elixir-ts-mode . ("sh" "~/.elixir-ls/release/language_server.sh"))))
|
||||||
|
|
||||||
(use-package
|
(use-package
|
||||||
elixir-ts-mode
|
elixir-ts-mode
|
||||||
@@ -94,8 +94,9 @@
|
|||||||
|
|
||||||
;;(add-hook 'after-init-hook #'global-mise-mode)
|
;;(add-hook 'after-init-hook #'global-mise-mode)
|
||||||
|
|
||||||
;; fix pdflatex for pdf export
|
;; fix pdflatex for pdf export (macOS-specific path)
|
||||||
(setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin"))
|
(when (eq system-type 'darwin)
|
||||||
|
(setenv "PATH" (concat (getenv "PATH") ":/Library/TeX/texbin")))
|
||||||
;; html export configuration, assuming use in a CMS or static site gerator that
|
;; html export configuration, assuming use in a CMS or static site gerator that
|
||||||
;; takes care of the layout
|
;; takes care of the layout
|
||||||
;; https://stackoverflow.com/questions/47508315/emacs-org-mode-export-to-html-without-syntax-highlighting
|
;; https://stackoverflow.com/questions/47508315/emacs-org-mode-export-to-html-without-syntax-highlighting
|
||||||
@@ -318,49 +319,17 @@
|
|||||||
(require 'qwan-blog)
|
(require 'qwan-blog)
|
||||||
(require 'qwan-refactor)
|
(require 'qwan-refactor)
|
||||||
|
|
||||||
;; https://github.com/karthink/gptel?tab=readme-ov-file#chatgpt
|
;; LLM configuration with gptel
|
||||||
;; (setq gptel-models
|
;; Machine-specific backends are configured in config-local.el
|
||||||
;; '(("Ollama" "localhost:11434" nil "http" t "/api/chat" nil
|
;; This file contains shared settings only
|
||||||
;; (qwen3:0.6B qwen3:32b hf.co/unsloth/Qwen3-30B-A3B-GGUF:Q5_K_M) "http://localhost:11434/api/chat" nil nil)))
|
|
||||||
;; https://yannesposito.com/posts/0029-ai-assistants-in-doom-emacs-31-on-macos-with-clojure-mcp-server/index.html
|
|
||||||
;; LLM
|
|
||||||
(use-package! gptel
|
(use-package! gptel
|
||||||
:init
|
:init
|
||||||
;; declare the default llm configuration
|
(setq gptel-default-mode 'org-mode) ;; LLM replies in org-mode format
|
||||||
;; for me this is co-pilot with claude-sonnet-4
|
(require 'gptel-integrations)) ;; <- for mcp
|
||||||
(setq gptel-default-mode 'org-mode ;; I want the llm to reply to me with org-mode format.
|
|
||||||
gptel-backend (gptel-make-openai "llama.cpp"
|
|
||||||
:host "localhost:8000"
|
|
||||||
:protocol "http"
|
|
||||||
:stream t
|
|
||||||
:models '(Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf))
|
|
||||||
gptel-model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf)
|
|
||||||
;; Do not use chatgpt as default. took long to find.
|
|
||||||
(setq-default gptel-model 'Qwen3-30B-A3B-Thinking-2507-Q6_K.gguf)
|
|
||||||
(require 'gptel-integrations) ;; <- for mcp
|
|
||||||
;; declare another llm configuration, 11434 is for llmacpp. I also use ollama fore smaller models that don't require
|
|
||||||
;; max speed or the latest API.
|
|
||||||
(gptel-make-ollama "Ollama"
|
|
||||||
:host "localhost:11434"
|
|
||||||
:stream t
|
|
||||||
|
|
||||||
:models '(qwen2.5-coder:7b
|
;; Load machine-specific configuration (gptel backends, etc.)
|
||||||
qwen3:0.6B
|
;; Create config-local.el with your machine's gptel-backend, gptel-model, and backends
|
||||||
(qwen2.5-coder:32b ;Full spec
|
(load! "config-local.el" doom-user-dir t)
|
||||||
:description
|
|
||||||
"qwen2.5 coder 32b: large coding model "
|
|
||||||
:capabilities (tools media)
|
|
||||||
:mime-types ("image/jpeg" "image/png" "image/svg"))))
|
|
||||||
|
|
||||||
(gptel-make-preset 'explain
|
|
||||||
:system "Explain what this code does to a novice programmer."
|
|
||||||
:model 'Qwen3-Coder-30B-A3B-Instruct-Q6_K.gguf
|
|
||||||
:backend "llama.cpp")
|
|
||||||
(gptel-make-preset 'elixir
|
|
||||||
:system "You are an expert programmer, specialising in Elixir and TDD, you live in Emacs"
|
|
||||||
:model 'Qwen3-Coder-30B-A3B-Instruct-Q6_K.gguf
|
|
||||||
:backend "llama.cpp")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
;; org-roam v1 port to v2, insert node without opening buffer
|
;; org-roam v1 port to v2, insert node without opening buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user