Commit 34a5283

HPCesia <me@hpcesia.com>
2026-06-12 18:57:26
Add Helix editor config
1 parent 12b1012
Changed files (6)
modules
develop
users
hpcesia
modules/develop/editor/helix/lang/nix.nix
@@ -0,0 +1,36 @@
+{
+  den.aspects.develop.editor.helix.lang.nix = {
+    homeManager = {
+      programs.helix = {
+        languages = {
+          language = [
+            {
+              name = "nix";
+              auto-format = true;
+              indent = {
+                tab-width = 2;
+                unit = "  ";
+              };
+              language-servers = ["nixd"];
+            }
+          ];
+          language-server = {
+            nil.config.nil = {
+              formatting.command = ["alejandra"];
+              nix = {
+                maxMemoryMB = 4096;
+                flake = {
+                  autoArchive = false;
+                  autoEvalInputs = true;
+                };
+              };
+            };
+            nixd.config.nixd = {
+              formatting.command = ["alejandra"];
+            };
+          };
+        };
+      };
+    };
+  };
+}
modules/develop/editor/helix/default.nix
@@ -0,0 +1,76 @@
+{
+  den.aspects.develop.editor.helix = {
+    cacheHome = {config, ...}: {
+      directories = [
+        "${config.xdg.dataHome}/helix" # Workspace trust data
+        "${config.xdg.dataHome}/steel" # Steel plugin system data
+      ];
+    };
+
+    homeManager = {pkgs, ...}: {
+      home.packages = [pkgs.steel-language-server];
+
+      programs.helix = {
+        enable = true;
+        package = pkgs.steelix;
+        settings = {
+          editor = {
+            line-number = "relative";
+            cursorline = true;
+            bufferline = "multiple";
+            statusline = {
+              left = ["mode" "spinner" "diagnostics" "workspace-diagnostics"];
+              center = ["file-name" "read-only-indicator" "file-modification-indicator"];
+              right = ["file-type" "file-encoding" "separator" "position" "total-line-numbers"];
+              mode.normal = "NORMAL";
+              mode.insert = "INSERT";
+              mode.select = "SELECT";
+            };
+            cursor-shape = {
+              normal = "block";
+              insert = "bar";
+              select = "block";
+            };
+            color-modes = true;
+            trim-trailing-whitespace = true;
+            inline-diagnostics.cursor-line = "warning";
+            end-of-line-diagnostics = "error";
+            lsp = {
+              display-inlay-hints = true;
+              inlay-hints-length-limit = 16;
+            };
+            indent-guides = {
+              render = true;
+              character = "┊";
+              skip-levels = 1;
+            };
+            file-picker = {
+              hidden = false;
+            };
+          };
+          keys = {
+            normal = {
+              "H" = "goto_previous_buffer";
+              "L" = "goto_next_buffer";
+            };
+          };
+        };
+      };
+
+      xdg.dataFile."steel" = {
+        source = pkgs.symlinkJoin {
+          name = "steel-plugins";
+          paths = with pkgs.nur.repos.hpcesia.helixPlugins; [
+            fcitx-focus
+            oil
+            wakatime
+          ];
+        };
+        recursive = true;
+      };
+
+      xdg.configFile."helix/init.scm".source = ./init.scm;
+      xdg.configFile."helix/helix.scm".source = ./helix.scm;
+    };
+  };
+}
modules/develop/editor/helix/helix.scm
@@ -0,0 +1,15 @@
+(require "helix/editor.scm")
+(require (prefix-in helix. "helix/commands.scm"))
+(require (prefix-in helix.static. "helix/static.scm"))
+
+(provide open-helix-scm open-init-scm)
+
+;;@doc
+;; Open the helix.scm file
+(define (open-helix-scm)
+  (helix.open (helix.static.get-helix-scm-path)))
+
+;;@doc
+;; Opens the init.scm file
+(define (open-init-scm)
+  (helix.open (helix.static.get-init-scm-path)))
modules/develop/editor/helix/init.scm
@@ -0,0 +1,31 @@
+(require "helix/configuration.scm")
+(require "helix/keymaps.scm")
+
+(define-lsp "steel-language-server" (command "steel-language-server") (args '()))
+(define-language "scheme" (language-servers '("steel-language-server")))
+
+(require "helix-fcitx-focus/cogs/fcitx-focus.scm")
+(require "wakatime/wakatime.scm")
+
+(require "oil/oil.scm")
+;; (oil-configure! show-dotfiles show-git-ignored)
+(oil-configure! #true #false)
+(keymap (global)
+  (normal
+    (space
+      (o
+        (o ":oil")
+        (e ":oil-enter")
+        (b ":oil-back")
+        (g ":oil-root")
+        (s ":oil-save")
+        (r ":oil-refresh")
+        (q ":oil-close")
+        (h ":oil-toggle-hidden")
+        (i ":oil-toggle-git-ignored")
+        (m
+          (y ":oil-yank")
+          (x ":oil-cut")
+          (p ":oil-paste")
+          (c ":oil-clipboard-clear"))))))
+
modules/develop/editor/helix/themes.nix
@@ -0,0 +1,20 @@
+{
+  den.aspects.develop.editor.helix.themes = {
+    catppuccin = {
+      homeManager = {pkgs, ...}: {
+        programs.helix = {
+          themes = {
+            catppuccin-mocha = pkgs.fetchurl {
+              pname = "helix-theme-catppuccin-mocha.toml";
+              url = "https://github.com/catppuccin/helix/raw/91e071bf9b9b2b8ae176a5581fcb61c789c55cab/themes/default/catppuccin_mocha.toml";
+              hash = "sha256-Z9tz20F/o/tZoR+19m3Otc/pj5Kpl7iZB1e2KzA+Lks=";
+            };
+          };
+          settings = {
+            theme = "catppuccin-mocha";
+          };
+        };
+      };
+    };
+  };
+}
modules/users/hpcesia/default.nix
@@ -1,9 +1,16 @@
 {den, ...}: {
   den.aspects.hpcesia = {
-    includes = [
-      den.batteries.host-aspects
-      den.batteries.primary-user
-    ];
+    includes =
+      [
+        den.batteries.host-aspects
+        den.batteries.primary-user
+      ]
+      ++ (den.lib.policy.when
+        ({host, ...}: host.hasAspect den.aspects.roles.develop)
+        (with den.aspects; [
+          develop.editor.helix
+          develop.editor.helix.lang.nix
+        ]));
   };
 
   den.users.registry.hpcesia = {