Modularizing emacs config

This commit is contained in:
Joe Frikker
2026-02-16 18:24:50 -05:00
parent 0dac9ad52e
commit 927e41991b

213
home.org
View File

@@ -645,35 +645,14 @@ Actually, nix *really* requires ~bash~. This is a plugin that allows using zsh f
#+END_SRC #+END_SRC
* Emacs * Emacs
:PROPERTIES:
:header-args:elisp: :tangle target/emacs.el
:header-args:nix: :noweb no-export :noweb-ref emacs_packages
:END:
Emacs is a huge portion of this configuration, so although it's a home-manager "program", I'm Emacs is a huge portion of this configuration, so although it's a home-manager "program", I'm
breaking it out into its own top-level section. Many of the sections here have two code blocks: a breaking it out into its own top-level section. Many of the sections here have two code blocks: a
nix code block listing the emacs packages to include, and an elisp code block to configure them in nix code block listing the emacs packages to include, and an elisp code block to configure them in
emacs. emacs.
#+BEGIN_SRC nix :tangle target/emacs.nix :noweb-ref We'll put the actual emacs configs into separate files, rather than into nix string literals. This
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
<<emacs_packages>>
];
extraConfig = builtins.readFile ./emacs.el;
};
}
#+END_SRC
We'll put the actual emacs config into a separate file, rather than into a nix string literal. This
helps with a few places where nix's string interpolation was causing problems. helps with a few places where nix's string interpolation was causing problems.
#+begin_src elisp
;;; -*- lexical-binding: t -*-
#+end_src
** Keybindings ** Keybindings
These keybindings are scattered throughout this file, I'm collecting them all here to make it easier These keybindings are scattered throughout this file, I'm collecting them all here to make it easier
to track them. to track them.
@@ -697,18 +676,30 @@ to track them.
| C-c M-g | | [[id:4F426E77-CE03-4BF8-8D1B-7791C7C02B28][Magit file dispatch]] | | | C-c M-g | | [[id:4F426E77-CE03-4BF8-8D1B-7791C7C02B28][Magit file dispatch]] | |
** Global Settings ** Global Settings
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-global.el
:END:
These are just some general settings that apply everywhere. First, a few packages: These are just some general settings that apply everywhere. First, a few packages:
#+BEGIN_SRC nix :noweb-ref emacs_packages #+BEGIN_SRC nix :tangle target/emacs-global.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
doom-modeline doom-modeline
ligature ligature
mixed-pitch mixed-pitch
ace-window ace-window
];
extraConfig = builtins.readFile ./emacs-global.el;
};
}
#+END_SRC #+END_SRC
Turn off some default settings that I don't find useful. Turn off some default settings that I don't find useful.
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
;;; -*- lexical-binding: t -*-
(setq inhibit-startup-screen t) (setq inhibit-startup-screen t)
(setq initial-scratch-message nil) (setq initial-scratch-message nil)
(menu-bar-mode -1) (menu-bar-mode -1)
@@ -892,7 +883,7 @@ move backward / forward through history.
"<right>" #'tab-bar-history-forward)) "<right>" #'tab-bar-history-forward))
#+END_SRC #+END_SRC
** Window Placement *** Window Placement
This section contains rules about where ~display-buffer~ should place windows. I guess I'm currently This section contains rules about where ~display-buffer~ should place windows. I guess I'm currently
going for an IDE-style layout, with one main editor window, and auxiliary bottom and right side going for an IDE-style layout, with one main editor window, and auxiliary bottom and right side
windows. I place windows in the bottom or on the right mostly depending on how wide I expect their windows. I place windows in the bottom or on the right mostly depending on how wide I expect their
@@ -947,16 +938,27 @@ content to be.
window-persistent-parameters)) window-persistent-parameters))
#+END_SRC #+END_SRC
** Editing ** Editing
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-editing.el
:END:
This configuration affects general text editing, across all modes. First, some packages: This configuration affects general text editing, across all modes. First, some packages:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-editing.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
avy avy
devil devil
edit-indirect edit-indirect
embark embark
god-mode god-mode
string-inflection string-inflection
];
extraConfig = builtins.readFile ./emacs-editing.el;
};
}
#+END_SRC #+END_SRC
I find Emacs to be almost unusable on a normal keyboard unless there's some way to avoid all the I find Emacs to be almost unusable on a normal keyboard unless there's some way to avoid all the
@@ -1072,8 +1074,15 @@ Just "silently" wrap when searching at the bottom of a document.
#+END_SRC #+END_SRC
** Language Support ** Language Support
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-languages.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
consult-eglot consult-eglot
haskell-ts-mode haskell-ts-mode
jenkinsfile-mode jenkinsfile-mode
@@ -1088,6 +1097,10 @@ Just "silently" wrap when searching at the bottom of a document.
tree-sitter tree-sitter
treesit-grammars.with-all-grammars treesit-grammars.with-all-grammars
yaml-pro yaml-pro
];
extraConfig = builtins.readFile ./emacs-languages.el;
};
}
#+END_SRC #+END_SRC
I had some weird problems with jsx code where the default M-q would just do a text fill rather than I had some weird problems with jsx code where the default M-q would just do a text fill rather than
@@ -1296,9 +1309,20 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Envrc ** Envrc
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-envrc.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-envrc.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
envrc envrc
];
extraConfig = builtins.readFile ./emacs-envrc.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1309,13 +1333,24 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Magit ** Magit
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-magit.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-magit.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
consult-gh consult-gh
diff-hl diff-hl
forge forge
git-timemachine git-timemachine
magit magit
];
extraConfig = builtins.readFile ./emacs-magit.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1350,8 +1385,15 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Vertico ** Vertico
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-vertico.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-vertico.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
cape cape
consult consult
corfu corfu
@@ -1359,6 +1401,10 @@ available? It seems to work for now anyway...
marginalia marginalia
orderless orderless
vertico vertico
];
extraConfig = builtins.readFile ./emacs-vertico.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1464,14 +1510,25 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Org ** Org
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-org.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-org.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
org-modern org-modern
org-present org-present
org-roam org-roam
ox-slack ox-slack
verb verb
visual-fill-column visual-fill-column
];
extraConfig = builtins.readFile ./emacs-org.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1602,9 +1659,20 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Terminal ** Terminal
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-terminal.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-terminal.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
eat eat
];
extraConfig = builtins.readFile ./emacs-terminal.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1614,9 +1682,20 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Slack ** Slack
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-slack.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
slack slack
];
extraConfig = builtins.readFile ./emacs-slack.el;
}
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1634,9 +1713,20 @@ available? It seems to work for now anyway...
#+END_SRC #+END_SRC
** Kubernetes ** Kubernetes
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-kubernetes.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-kubernetes.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
kubed kubed
];
extraConfig = builtins.readFile ./emacs-kubernetes.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1647,14 +1737,32 @@ available? It seems to work for now anyway...
** Ledger ** Ledger
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-ledger.el
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
ledger-mode ledger-mode
];
};
}
#+END_SRC #+END_SRC
** Age ** Age
:PROPERTIES:
:header-args:elisp: :tangle target/emacs-age.el
:END:
#+BEGIN_SRC nix #+BEGIN_SRC nix :tangle target/emacs-age.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
age age
];
extraConfig = builtins.readFile ./emacs-age.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp #+BEGIN_SRC elisp
@@ -1667,29 +1775,6 @@ age
(age-file-enable)) (age-file-enable))
#+END_SRC #+END_SRC
** Snippets
#+BEGIN_SRC nix
yasnippet
#+END_SRC
#+BEGIN_SRC elisp
(yas-global-mode)
#+END_SRC
*** Org Mode
#+BEGIN_SRC snippet :tangle target/snippets/org-mode/src
# name: SRC block
# key: src
# expand-env: ((yas-indent-line 'fixed))
# --
,#+BEGIN_SRC ${1:elisp}
$0
,#+END_SRC
#+END_SRC
* Theme * Theme
I like Catppuccin Frappe as my theme. Let's use it in as many places as we can. I like Catppuccin Frappe as my theme. Let's use it in as many places as we can.
@@ -1780,11 +1865,23 @@ I like Catppuccin Frappe as my theme. Let's use it in as many places as we can.
#+END_SRC #+END_SRC
** Emacs ** Emacs
#+BEGIN_SRC nix :noweb-ref "emacs_packages" :PROPERTIES:
:header-args:elisp: :tangle target/emacs-theme.el
:END:
#+BEGIN_SRC nix :tangle target/emacs-theme.nix
{
programs.emacs = {
enable = true;
extraPackages = epkgs: with epkgs; [
catppuccin-theme catppuccin-theme
];
extraConfig = builtins.readFile ./emacs-theme.el;
};
}
#+END_SRC #+END_SRC
#+BEGIN_SRC elisp :tangle target/emacs.el #+BEGIN_SRC elisp
(use-package catppuccin-theme (use-package catppuccin-theme
:custom :custom
(catppuccin-flavor 'frappe) (catppuccin-flavor 'frappe)