From 0082cb1b3312a78ed5746e9a3da996dea3a8bf70 Mon Sep 17 00:00:00 2001 From: Joe Frikker Date: Sun, 15 Feb 2026 22:09:56 -0500 Subject: [PATCH] wip --- flake.nix | 1 + home.org | 166 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 99 insertions(+), 68 deletions(-) diff --git a/flake.nix b/flake.nix index cbc6ea3..6ec676c 100644 --- a/flake.nix +++ b/flake.nix @@ -71,5 +71,6 @@ extraSpecialArgs = { kube = kube.packages.x86_64-linux.default; }; }; + packages.aarch64-darwin.default = modules-for-system nixpkgs.legacyPackages.aarch64-darwin; }; } diff --git a/home.org b/home.org index 8bdafde..7d0e31f 100644 --- a/home.org +++ b/home.org @@ -145,7 +145,7 @@ are still Shibumi-specific; ideally I'd find another way to install them. * Program Configurations :PROPERTIES: -:header-args: :noweb-ref programs :noweb no-export +:header-args:nix: :noweb-ref programs :noweb no-export :END: This section contains applications whose config files will be generated by Home Manager. Home @@ -356,22 +356,22 @@ set -g default-command "" ''; #+END_SRC ** Wezterm +:PROPERTIES: +:header-args:lua: :tangle target/wezterm.lua +:END: ~wezterm~ is a fast terminal emulator and multiplexer. It is configured using lua. We'll define its config in two blocks, so we can get lua syntax highlighting in org. First, the nix configuration: -#+BEGIN_SRC nix :noweb no-export +#+BEGIN_SRC nix wezterm.enable = true; - wezterm.extraConfig = '' - local config = {} - <> - <> - ''; + wezterm.extraConfig = builtins.readFile ./wezterm.lua; #+END_SRC Then the real lua config: -#+BEGIN_SRC lua :noweb-ref wezterm +#+BEGIN_SRC lua + local config = {} config.default_prog = { '/Users/jfrikker/.nix-profile/bin/zsh', '-l' } config.font_size = 13.0 -- config.font = wezterm.font("JetBrains Mono") @@ -389,7 +389,7 @@ Then the real lua config: I use a workspace switcher plugin, bouned to ~cmd-s~, that lets me quickly switch between per-project workspaces using a single OS window. -#+BEGIN_SRC lua :noweb-ref wezterm +#+BEGIN_SRC lua local workspace_switcher = wezterm.plugin.require("https://github.com/MLFlexer/smart_workspace_switcher.wezterm") workspace_switcher.zoxide_path='~/.nix-profile/bin/zoxide' #+END_SRC @@ -400,7 +400,7 @@ one. I use "edit" for running the editor (obviously), "run" for building / runni and "term" for miscellaneous other tasks. I sometimes split the "run" window into multiple panes if the project requires multiple things to run simultaneously. -#+BEGIN_SRC lua :noweb-ref wezterm +#+BEGIN_SRC lua wezterm.on('smart_workspace_switcher.workspace_switcher.created', function(window, path, workspace) local editor = window:active_tab() editor:set_title("edit") @@ -417,7 +417,7 @@ the project requires multiple things to run simultaneously. Put the current workspace name in the lower-right corner of the window. Taken from [https://alexplescan.com/posts/2024/08/10/wezterm/]. -#+BEGIN_SRC lua :noweb-ref wezterm +#+BEGIN_SRC lua local function segments_for_right_status(window) return { window:active_workspace(), @@ -488,7 +488,7 @@ Now we'll set up some keybindings: | s-d | Close the current tab (with confirmation). | | s-123456789 | Switch to the tab with the corresponding number. | -#+BEGIN_SRC lua :noweb-ref wezterm +#+BEGIN_SRC lua config.leader = { key = ' ', mods = 'CTRL', timeout_milliseconds = 10000 } config.keys = { { @@ -558,8 +558,6 @@ Now we'll set up some keybindings: action = wezterm.action.ActivateTab(i - 1), }) end - - return config #+END_SRC ** Zsh @@ -595,23 +593,31 @@ Actually, nix *really* requires ~bash~. This is a plugin that allows using zsh f #+END_SRC * 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 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 emacs. -#+BEGIN_SRC nix :noweb no-export :noweb-ref programs +#+BEGIN_SRC nix :noweb-ref programs emacs.enable = true; emacs.extraPackages = epkgs: with epkgs; [ <> ]; - emacs.extraConfig = '' - ;;; -*- lexical-binding: t -*- - <> - ''; + emacs.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. + +#+begin_src elisp + ;;; -*- lexical-binding: t -*- +#+end_src + ** Keybindings These keybindings are scattered throughout this file, I'm collecting them all here to make it easier to track them. @@ -646,7 +652,7 @@ These are just some general settings that apply everywhere. First, a few package Turn off some default settings that I don't find useful. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq inhibit-startup-screen t) (setq initial-scratch-message nil) (menu-bar-mode -1) @@ -664,28 +670,28 @@ Turn off some default settings that I don't find useful. Make sure which-key mode is always on. The on-the-fly keymap help it gives is indespensable. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (which-key-mode) #+END_SRC Automatically refresh ~dired~ buffers when switching to them, instead of requiring an explicit refresh. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq dired-auto-revert-buffer t) #+END_SRC Similarly, highlighting the line the cursor is on is really useful for figuring out where you are, especially on monitors with a lot of vertical space. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (global-hl-line-mode) #+END_SRC From the docs: "If ‘complete’, TAB first tries to indent the current line, and if the line was already indented, then try to complete the thing at point." Recommended by [[https://github.com/minad/corfu][the ~corfu~ readme]]. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq tab-always-indent 'complete) #+END_SRC @@ -694,7 +700,7 @@ current character isn't really "selected" like it would be in Helix. When I had switched to a block cursor during normal mode, just because I was so used to it from Helix and Vim. Now, I don't think there's really a need to ever switch. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq-default cursor-type 'bar) #+END_SRC @@ -703,7 +709,7 @@ want changes I've made to be immediately saved to disk. So let's have Emacs do t fairly long (~5 sec) delay before changes are saved, which is kind of annoying. Maybe I'll look into that at some point? -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (auto-save-visited-mode) #+END_SRC @@ -711,14 +717,14 @@ Repeat-mode takes care of eliminating some annoying duplicate keypresses. I most for two-character commands that need to be repeated; ~devil~ also has some single-key-with-modifier repeats set up that only apply in that mode. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (repeat-mode) #+END_SRC Save the minibuffer history to disk, so recently-used options show up at the top of the picker across restarts. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (savehist-mode) #+END_SRC @@ -727,7 +733,7 @@ it would update after every command, slowing down everything). I don't need the I have the tab bar at the top of the window. The other settings just clear up some space, and make things look at little nicer. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq doom-modeline-irc nil) (setq doom-modeline-workspace-name nil) (setq doom-modeline-buffer-encoding nil) @@ -739,7 +745,7 @@ Ligature mode combines character sequences like <= into a single on-screen glyph cool, so I'm turning it on in prog mode. The enabled ligatures are font-specific, taken from [[https://github.com/mickeynp/ligature.el/wiki#jetbrains-mono][the ligature wiki]]. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package ligature :after prog-mode :config @@ -762,7 +768,7 @@ ligature wiki]]. Use variable-width fonts in text buffers. ~mixed-pitch-mode~ keeps most code blocks as monospace. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (add-hook 'text-mode-hook 'mixed-pitch-mode) (defun no-mixed-pitch () @@ -774,7 +780,7 @@ Use variable-width fonts in text buffers. ~mixed-pitch-mode~ keeps most code blo A basic ace-window setup. Allows switching between windows quickly (although avy can do the same...). -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package ace-window :bind (("M-o" . ace-window) ("s-o" . ace-window)) @@ -786,7 +792,7 @@ A basic ace-window setup. Allows switching between windows quickly (although avy Set up a few project- / workspace-related key bindings. #+name: workspace_keybinds -#+BEGIN_SRC elisp :noweb no :noweb-ref emacs_config +#+BEGIN_SRC elisp (bind-keys ("s-f" . project-find-file) ("s-F" . project-switch-project)) (bind-keys :map tab-bar-mode-map @@ -795,20 +801,20 @@ Set up a few project- / workspace-related key bindings. Don't run a server. I'm not using this, I can always turn it back on if I need to. -#+BEGIN_SRC elisp :noweb no :noweb-ref emacs_config +#+BEGIN_SRC elisp (server-mode -1) #+END_SRC All the beeping is annoying. This flashes a huge icon over the screen, which is still annoying, but less so? -#+BEGIN_SRC elisp :noweb no :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq visible-bell t) #+END_SRC I'm trying this out. This disables visual selections. It's bold, which is why I like it :) -#+BEGIN_SRC elisp :noweb no :noweb-ref emacs_config +#+BEGIN_SRC elisp (transient-mark-mode -1) #+END_SRC @@ -820,7 +826,7 @@ fix / issue, and leave it open until I'm done with that issue. change when drilling into a help page or something. I've set up repeat mode to make it easier to move backward / forward through history. -#+BEGIN_SRC elisp :noweb no :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package tab-bar :config (tab-bar-history-mode) @@ -836,7 +842,7 @@ going for an IDE-style layout, with one main editor window, and auxiliary bottom windows. I place windows in the bottom or on the right mostly depending on how wide I expect their content to be. -#+BEGIN_SRC elisp :noweb no :noweb-ref emacs_config +#+BEGIN_SRC elisp (setq display-buffer-alist '(((or "\\*Flymake diagnostics *" "\\*Embark Export *" @@ -858,6 +864,7 @@ content to be. (no-other-window . t))) ((or "magit: *" "magit-revision: *" + "magit-log*" "\\*eldoc\\*" "\\*Help\\*" "\\*rustfmt\\*" @@ -887,7 +894,7 @@ content to be. This configuration affects general text editing, across all modes. First, some packages: -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix avy devil edit-indirect @@ -907,7 +914,7 @@ but I'm worried that having too many repeat maps will also be annoying (I'll hav cancel them more frequently). In the end, I opted for Devil mode. It avoids modifier keys, and has its own devil-mode-only repeat maps that don't interfere when using normal modifier key sequences. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package devil :disable t :config @@ -944,7 +951,7 @@ Avy allows jumping to any place on the screen with just a few keystrokes. I've s ideas from Karthinks' article [[https://karthinks.com/software/avy-can-do-anything/][Avy can do Anything]]. I need to find more uses for this, in line with his article. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package avy :bind ("M-j" . avy-goto-char-timer)) @@ -974,13 +981,13 @@ his article. Just "silently" wrap when searching at the bottom of a document. -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package isearch :custom (isearch-wrap-pause 'no-ding)) #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package string-inflection :commands string-inflection-java-style-cycle @@ -1010,7 +1017,7 @@ Just "silently" wrap when searching at the bottom of a document. ** Language Support -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix consult-eglot haskell-ts-mode jenkinsfile-mode @@ -1031,7 +1038,7 @@ I had some weird problems with jsx code where the default M-q would just do a te a re-indent. The solution seems to be to only do the ~syntax-ppss~ stuff if tree-sitter isn't available? It seems to work for now anyway... -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (electric-pair-mode 1) (use-package prog-mode @@ -1061,7 +1068,7 @@ available? It seems to work for now anyway... (indent-region start (point) nil))))))) #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package nix-mode :mode "\\.nix\\'") @@ -1234,11 +1241,11 @@ available? It seems to work for now anyway... ** Envrc -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix envrc #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package envrc :hook (after-init . envrc-global-mode) :custom @@ -1247,7 +1254,7 @@ available? It seems to work for now anyway... ** Magit -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix consult-gh diff-hl forge @@ -1255,7 +1262,7 @@ available? It seems to work for now anyway... magit #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package magit :defer nil :bind (("C-x g" . magit-status) @@ -1288,7 +1295,7 @@ available? It seems to work for now anyway... ** Vertico -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix cape consult corfu @@ -1298,7 +1305,7 @@ available? It seems to work for now anyway... vertico #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package consult :bind ( ;; ("C-c M-x" . consult-mode-command) @@ -1347,7 +1354,7 @@ available? It seems to work for now anyway... (advice-add #'register-preview :override #'consult-register-window) (setq register-preview-delay 0.5) - ;; (setq xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref) + (setq xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref) :config @@ -1361,8 +1368,6 @@ available? It seems to work for now anyway... :preview-key '(:debounce 0.4 any)) (setq consult-narrow-key "<") ;; "C-+" - (setq xref-show-xrefs-function #'consult-xref - xref-show-definitions-function #'consult-xref) ) (use-package vertico @@ -1404,7 +1409,7 @@ available? It seems to work for now anyway... ** Org -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix org-modern org-present org-roam @@ -1413,7 +1418,7 @@ available? It seems to work for now anyway... visual-fill-column #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package org :defer nil :mode ("\\.org\\'" . org-mode) @@ -1542,11 +1547,11 @@ available? It seems to work for now anyway... ** Terminal -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix eat #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package eat :config (eat-eshell-mode)) @@ -1554,11 +1559,11 @@ available? It seems to work for now anyway... ** Slack -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix slack #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package lui :defer t :custom @@ -1574,11 +1579,11 @@ available? It seems to work for now anyway... ** Kubernetes -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix kubed #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package kubed :bind-keymap ("s-k" . kubed-prefix-map)) @@ -1586,17 +1591,17 @@ available? It seems to work for now anyway... ** Ledger -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix ledger-mode #+END_SRC ** Age -#+BEGIN_SRC nix :noweb-ref emacs_packages +#+BEGIN_SRC nix age #+END_SRC -#+BEGIN_SRC elisp :noweb-ref emacs_config +#+BEGIN_SRC elisp (use-package age :custom (age-default-identity "~/source/dotfiles/keys/yubi1age.txt") @@ -1606,6 +1611,29 @@ age (age-file-enable)) #+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 I like Catppuccin Frappe as my theme. Let's use it in as many places as we can. @@ -1678,8 +1706,10 @@ I like Catppuccin Frappe as my theme. Let's use it in as many places as we can. ** Wezterm #+NAME: wezterm_colors -#+BEGIN_SRC lua +#+BEGIN_SRC lua :tangle target/wezterm.lua config.color_scheme = 'Catppuccin Frappe' + + return config #+END_SRC ** Emacs @@ -1688,7 +1718,7 @@ I like Catppuccin Frappe as my theme. Let's use it in as many places as we can. catppuccin-theme #+END_SRC -#+BEGIN_SRC elisp :noweb-ref "emacs_config" +#+BEGIN_SRC elisp :tangle target/emacs.el (use-package catppuccin-theme :custom (catppuccin-flavor 'frappe)