From ce05d9398d0df62c00888474e28026819defcd62 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 3 Jan 2026 11:07:35 -0800 Subject: configure aider and emacs properly Use anthropic's models and set the API key. --- home/profiles/darwin.nix | 10 ++++++++++ home/programs/aider.nix | 20 +++++++++----------- home/programs/emacs/default.nix | 3 ++- home/programs/emacs/init.el | 3 ++- home/programs/emacs/site-lisp/init-llm.el | 15 +++++++++++++++ home/programs/emacs/site-lisp/init-ui.el | 2 +- 6 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 home/programs/emacs/site-lisp/init-llm.el (limited to 'home') diff --git a/home/profiles/darwin.nix b/home/profiles/darwin.nix index 136a93f..53c6ff8 100644 --- a/home/profiles/darwin.nix +++ b/home/profiles/darwin.nix @@ -3,6 +3,12 @@ age = { identityPaths = [ "${config.home.homeDirectory}/.ssh/agenix" ]; secretsDir = "${config.home.homeDirectory}/.local/share/agenix"; + + secrets = { + anthropic-api-key = { + file = ../../secrets/users/fcuny/anthropic-api-key.age; + }; + }; }; imports = [ @@ -39,6 +45,10 @@ ps = "${pkgs.procs}/bin/procs"; }; + programs.fish.shellInit = '' + export ANTHROPIC_API_KEY="$(cat ${config.age.secrets.anthropic-api-key.path})" + ''; + home.sessionPath = [ "${config.home.homeDirectory}/.local/bin" ]; diff --git a/home/programs/aider.nix b/home/programs/aider.nix index 3493f42..4c52742 100644 --- a/home/programs/aider.nix +++ b/home/programs/aider.nix @@ -4,18 +4,16 @@ aider-chat ]; - home.sessionVariables = { - OLLAMA_API_BASE = "http://rivendell:11434"; - AIDER_ANALYTIC = "false"; - AIDER_ANALYTICS_DISABLE = "true"; - AIDER_ATTRIBUTE_AUTHO = "false"; - AIDER_AUTO_COMMITS = "false"; - AIDER_CHECK_UPDATE = "false"; - AIDER_SHOW_DIFFS = "true"; - AIDER_SUBTREE_ONLY = "true"; + programs.git = { + ignores = [ ".aider*" ]; }; - programs.fish.shellAliases = { - laider = "aider --model ollama_chat/qwen3:8b"; + xdg.configFile."aider/config.yml".text = pkgs.lib.generators.toYAML { } { + model = "anthropic/claude-sonnet-4-5"; + weak-model = "anthropic/claude-3-5-haiku"; + attribute-author = false; + attribute-committer = false; + analytics-disable = true; + check-update = false; }; } diff --git a/home/programs/emacs/default.nix b/home/programs/emacs/default.nix index 35a6c47..1463bf2 100644 --- a/home/programs/emacs/default.nix +++ b/home/programs/emacs/default.nix @@ -7,7 +7,7 @@ let packages = epkgs: with epkgs; [ - aidermacs # pair programming in Emacs with Aider + aider # pair programming in Emacs with Aider cape cargo consult @@ -60,6 +60,7 @@ let "site-lisp/init-base.el" "site-lisp/init-completion.el" "site-lisp/init-eshell.el" + "site-lisp/init-llm.el" "site-lisp/init-programming.el" "site-lisp/init-text.el" "site-lisp/init-ui.el" diff --git a/home/programs/emacs/init.el b/home/programs/emacs/init.el index 5afbbeb..a1ff154 100644 --- a/home/programs/emacs/init.el +++ b/home/programs/emacs/init.el @@ -8,7 +8,7 @@ (use-package exec-path-from-shell :custom - (exec-path-from-shell-variables '("PATH" "MANPATH" "GOPATH" "GOBIN" "ASPELL_CONF")) + (exec-path-from-shell-variables '("PATH" "MANPATH" "GOPATH" "GOBIN" "ASPELL_CONF" "ANTHROPIC_API_KEY")) :init (exec-path-from-shell-initialize)) (require 'init-base) @@ -17,6 +17,7 @@ (require 'init-text) (require 'init-programming) (require 'init-eshell) +(require 'init-llm) (use-package server :config diff --git a/home/programs/emacs/site-lisp/init-llm.el b/home/programs/emacs/site-lisp/init-llm.el new file mode 100644 index 0000000..bdd1804 --- /dev/null +++ b/home/programs/emacs/site-lisp/init-llm.el @@ -0,0 +1,15 @@ +;;; init-llm.el --- Configure LLMs -*- lexical-binding: t -*- +;; Author: Franck Cuny + +;;; Commentary: + +;; Configure completions + +;;; Code: + +(use-package aider + :bind ("C-c a" . aider-transient-menu)) + +(provide 'init-llm) + +;;; init-llm.el ends here diff --git a/home/programs/emacs/site-lisp/init-ui.el b/home/programs/emacs/site-lisp/init-ui.el index 478028b..38d93e4 100644 --- a/home/programs/emacs/site-lisp/init-ui.el +++ b/home/programs/emacs/site-lisp/init-ui.el @@ -41,7 +41,7 @@ (modus-themes-region '()) :init - (load-theme 'modus-operandi-tinted t)) + (load-theme 'modus-vivendi-tinted t)) (provide 'init-ui) ;;; init-ui.el ends here -- cgit v1.2.3