From c82a8683abc03708b7ca84742351a1b6bb9c156b Mon Sep 17 00:00:00 2001
From: mehbark <terezi@pyrope.net>
Date: Sun, 2 Mar 2025 22:42:06 -0500
Subject: [PATCH] small tweaks hopefully

---
 fish.conf.nix       |  2 --
 flake.nix           |  5 ++++-
 home.nix            | 10 +++++++---
 init.el.nix         | 32 +++++++++++++++++++++-----------
 vscode-settings.nix |  2 +-
 5 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/fish.conf.nix b/fish.conf.nix
index c6f6b75..920e077 100644
--- a/fish.conf.nix
+++ b/fish.conf.nix
@@ -120,9 +120,7 @@ end
 alias xpy '~/Aims/rust/x.py'
 # alias sbcl "rlwrap sbcl"
 # alias guile "rlwrap guile"
-alias chez "rlwrap chez"
 #alias clj 'clojure -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"} $args}}" -m rebel-readline.main'
-alias csi "rlwrap chicken-csi"
 
 # zig
 alias zb "zig build"
diff --git a/flake.nix b/flake.nix
index cff82d8..c56cc9c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -100,7 +100,10 @@
     packages.x86_64-linux = {
       iso = nixos-generators.nixosGenerate {
         system = "x86_64-linux";
-        modules = modules;
+        modules = modules ++ [{
+          nix.registry.nixpkgs.flake = nixpkgs;
+          virtualisation.diskSize = 20 * 1024;
+        }];
         format = "iso";
       };
     };
diff --git a/home.nix b/home.nix
index 74849c6..1e8cf5b 100644
--- a/home.nix
+++ b/home.nix
@@ -45,11 +45,13 @@ in
     cabal-install
     sbcl
     chez
+    chicken
     guile
     gambit
     clojure
     ruby_3_3
     ruby-lsp
+    elixir
     rubocop
     lua
     maxima
@@ -76,6 +78,7 @@ in
     ffmpeg
     libjxl
     exiftool
+    gnupg
 
     akku
     ripgrep
@@ -268,6 +271,7 @@ in
       };
       core.autocrlf = false;
       init.defaultBranch = "main";
+      user.signingkey = "8CD6E1438A00F55363157881E333EC1335FFCCDB";
     };
   };
 
@@ -354,18 +358,19 @@ in
 
   programs.emacs = {
     enable = true;
-    package = pkgs.emacs29-pgtk;
+    package = pkgs.emacs30-pgtk;
     extraPackages = epkgs: with epkgs; [
       lsp-mode
       markdown-mode
       yaml-mode
       json-mode
-      elixir-mode
       clojure-mode
       haskell-mode
       zig-mode
       python-mode
 
+      treesit-grammars.with-all-grammars
+
       quack
 
       which-key
@@ -388,7 +393,6 @@ in
       #eshell
       orderless
       magit
-      eglot
       org
       org-roam
       paredit
diff --git a/init.el.nix b/init.el.nix
index c434fdd..6d37535 100644
--- a/init.el.nix
+++ b/init.el.nix
@@ -219,6 +219,12 @@ If the new path's directories does not exist, create them."
 ;; Nice line wrapping when working with text
 (add-hook 'text-mode-hook 'visual-line-mode)
 
+;; mix format
+(add-hook 'after-save-hook
+  '(lambda ()
+     (when (eq major-mode 'elixir-ts-mode)
+       (shell-command-to-string (format "mix format %s" (buffer-file-name))))))
+
 ;; Modes to highlight the current line with
 (let ((hl-line-hooks '(text-mode-hook prog-mode-hook)))
   (mapc (lambda (hook) (add-hook hook 'hl-line-mode)) hl-line-hooks))
@@ -482,10 +488,16 @@ If the new path's directories does not exist, create them."
           (typescript-mode . typescript-ts-mode)
           (json-mode . json-ts-mode)
           (css-mode . css-ts-mode)
-          (python-mode . python-ts-mode)))
+          (python-mode . python-ts-mode)
+          (elixir-mode . elixir-ts-mode)))
+  (add-to-list 'auto-mode-alist
+    '("\\.ex\\'" . elixir-mode))
+  (add-to-list 'auto-mode-alist
+    '("\\.exs\\'" . elixir-mode))
+
   :hook
   ;; Auto parenthesis matching
-  ((prog-mode . electric-pair-mode)))
+  (prog-mode . electric-pair-mode))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
@@ -527,17 +539,19 @@ If the new path's directories does not exist, create them."
   ;; no :ensure t here because it's built-in
 
   ;; Configure hooks to automatically turn-on eglot for selected modes
-  ; :hook
-  ; (((python-mode ruby-mode elixir-mode) . eglot))
+  :hook
+  ; (((python-mode ruby-mode) . eglot))
+  ((elixir-ts-mode . eglot-ensure))
 
   :custom
-  (eglot-send-changes-idle-time 0.1)
+  ;; let's try a higher idle time, elixir-ls is a bit finicky
+  (eglot-send-changes-idle-time 0.5)
 
   :config
   (fset #'jsonrpc--log-event #'ignore)  ; massive perf boost---don't log every event
   ;; Sometimes you need to tell Eglot where to find the language server
-  ; (add-to-list 'eglot-server-programs
-  ;              '(haskell-mode . ("haskell-language-server-wrapper" "--lsp")))
+  (add-to-list 'eglot-server-programs
+               '(elixir-ts-mode "${pkgs.elixir-ls}/bin/elixir-ls"))
   )
 
 ; oorg
@@ -1030,10 +1044,6 @@ If the new path's directories does not exist, create them."
   :config
   (direnv-mode))
 
-(use-package lsp-mode
-  :ensure t
-  :commands (lsp lsp-deferred))
-
 ; yay
 (setq confirm-kill-processes nil)
 (setq auto-save-interval 100)
diff --git a/vscode-settings.nix b/vscode-settings.nix
index 9c3e4b8..9f4fc63 100644
--- a/vscode-settings.nix
+++ b/vscode-settings.nix
@@ -13,7 +13,7 @@
   "[html]" = { "editor.defaultFormatter" = "esbenp.prettier-vscode"; };
   "[java]" = { "editor.suggest.snippetsPreventQuickSuggestions" = false; };
   "[javascript]" = {
-    "editor.defaultFormatter" = null;
+    "editor.defaultFormatter" = "esbenp.prettier-vscode";
     "editor.formatOnSave" = true;
   };
   "[javascriptreact]" = {