zaphyra's git: nixfiles

zaphyra's nixfiles

commit 7f47268a5aa08d575815655ee14d4bac2a69a870
parent 21c7de5b4a7aeda4b1db6b55682ef81d4e7b93bb
Author: Katja Ramona Sophie Kwast (zaphyra) <git@zaphyra.eu>
Date: Sun, 24 Aug 2025 19:20:26 +0200

config/home-manager/zaphyra/programs/micro: improve lsp stuff
6 files changed, 179 insertions(+), 150 deletions(-)
diff --git a/config/home-manager/zaphyra/programs/languages/golang.nix b/config/home-manager/zaphyra/programs/languages/golang.nix
@@ -1,10 +1,12 @@
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
 
 {
 
   home = {
     packages = [ pkgs.go ];
     sessionVariables.GOPATH = "${config.xdg.dataHome}/go";
+
   };
+  programs.micro.lsp-servers.go.command = lib.getExe pkgs.gopls;
 
 }
diff --git a/config/home-manager/zaphyra/programs/languages/javascript.nix b/config/home-manager/zaphyra/programs/languages/javascript.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ lib, pkgs, ... }:
 
 {
 

@@ -7,6 +7,7 @@
     pnpm
   ];
 
+  programs.micro.lsp-servers.js.command = lib.getExe pkgs.typescript-language-server;
   programs.helix.extraPackages = [
     pkgs.typescript-language-server
   ];
diff --git a/config/home-manager/zaphyra/programs/languages/nimlang.nix b/config/home-manager/zaphyra/programs/languages/nimlang.nix
@@ -1,4 +1,4 @@
-{ pkgs, ... }:
+{ lib, pkgs, ... }:
 
 {
 

@@ -7,6 +7,8 @@
     nimble
   ];
 
+  programs.micro.lsp-servers.nim.command = lib.getExe pkgs.nimlangserver;
+
   programs.helix.extraPackages = [
     pkgs.nimlangserver
   ];
diff --git a/config/home-manager/zaphyra/programs/languages/nix.nix b/config/home-manager/zaphyra/programs/languages/nix.nix
@@ -0,0 +1,16 @@
+{ lib, pkgs, ... }:
+
+{
+
+  home.packages = [ pkgs.nixfmt-rfc-style ];
+
+  programs.micro.lsp-servers.nix = {
+    command = lib.getExe pkgs.nixd;
+    options = {
+      config = builtins.toJSON {
+        formatting.command = [ (lib.getExe pkgs.nixfmt-rfc-style) ];
+      };
+    };
+  };
+
+}+
\ No newline at end of file
diff --git a/config/home-manager/zaphyra/programs/micro.nix b/config/home-manager/zaphyra/programs/micro.nix
@@ -8,12 +8,25 @@
 
 {
 
-  home = {
-    sessionVariables.EDITOR = "micro";
-    shellAliases.nano = "micro";
+  options.programs.micro.lsp-servers = lib.mkOption {
+    default = { };
+    type = lib.types.attrsOf (
+      lib.types.submodule {
+        options = {
+          command = lib.mkOption {
+            type = lib.types.str;
+          };
+          options = lib.mkOption {
+            type = (pkgs.formats.json { }).type;
+            default = { };
+          };
+        };
+      }
+    );
   };
 
-  programs.micro = {
+  config.programs.sherlock.settings.ignore = "Micro";
+  config.programs.micro = {
     enable = true;
     package =
       if systemConfig.modules.presets.graphical.enable then pkgs.micro-with-wl-clipboard else pkgs.micro;

@@ -53,159 +66,152 @@
               ])
             )
           )
-          {
-            js.command = lib.getExe pkgs.typescript-language-server;
-            nim.command = lib.getExe pkgs.nimlangserver;
-            go.command = lib.getExe pkgs.gopls;
-            nix.command = lib.getExe pkgs.nixd;
-            nix.options = {
-              config = builtins.toJSON {
-                formatting.command = [ (lib.getExe pkgs.nixfmt-rfc-style) ];
-              };
-            };
-          }
+          config.programs.micro.lsp-servers
         );
     };
   };
 
-  home.file = {
-    # keybindings
-    "${config.xdg.configHome}/micro/bindings.json".source = pkgs.writeText "micro-keybindings.json" (builtins.toJSON {
-      "Alt-," = "PreviousTab";
-      "Alt-." = "NextTab";
-      "Alt-Backspace" = "DeleteWordLeft";
-      "Alt-CtrlH" = "DeleteWordLeft";
-      "Alt-F" = "FindLiteral";
-      "Alt-[" = "DiffPrevious|CursorStart";
-      "Alt-]" = "DiffNext|CursorEnd";
-      "Alt-a" = "StartOfLine";
-      "Alt-b" = "WordLeft";
-      "Alt-c" = "RemoveAllMultiCursors";
-      "Alt-e" = "EndOfLine";
-      "Alt-f" = "WordRight";
-      "Alt-g" = "ToggleKeyMenu";
-      "Alt-m" = "SpawnMultiCursorSelect";
-      "Alt-n" = "SpawnMultiCursor";
-      "Alt-p" = "RemoveMultiCursor";
-      "Alt-x" = "SkipMultiCursor";
-      "Alt-{" = "ParagraphPrevious";
-      "Alt-}" = "ParagraphNext";
-      "AltDown" = "MoveLinesDown";
-      "AltLeft" = "StartOfTextToggle";
-      "AltRight" = "EndOfLine";
-      "AltShiftDown" = "SpawnMultiCursorDown";
-      "AltShiftLeft" = "SelectToStartOfTextToggle";
-      "AltShiftRight" = "SelectToEndOfLine";
-      "AltShiftUp" = "SpawnMultiCursorUp";
-      "AltUp" = "MoveLinesUp";
-      "Backspace" = "Backspace";
-      "Backtab" = "OutdentSelection|OutdentLine";
-      "Ctrl-MouseLeft" = "MouseMultiCursor";
-      "Ctrl-a" = "SelectAll";
-      "Ctrl-b" = "ShellMode";
-      "Ctrl-c" = "Copy|CopyLine";
-      "Ctrl-d" = "DuplicateLine";
-      "Ctrl-e" = "CommandMode";
-      "Ctrl-f" = "Find";
-      "Ctrl-g" = "ToggleHelp";
-      "Ctrl-h" = "Backspace";
-      "Ctrl-j" = "PlayMacro";
-      "Ctrl-k" = "CutLine";
-      "Ctrl-l" = "command-edit:goto ";
-      "Ctrl-n" = "FindNext";
-      "Ctrl-o" = "OpenFile";
-      "Ctrl-p" = "FindPrevious";
-      "Ctrl-q" = "Quit";
-      "Ctrl-r" = "ToggleRuler";
-      "Ctrl-s" = "Save";
-      "Ctrl-t" = "AddTab";
-      "Ctrl-u" = "ToggleMacro";
-      "Ctrl-v" = "Paste";
-      "Ctrl-w" = "NextSplit";
-      "Ctrl-x" = "Cut|CutLine";
-      "Ctrl-y" = "Redo";
-      "Ctrl-z" = "Undo";
-      "CtrlDown" = "CursorEnd";
-      "CtrlEnd" = "CursorEnd";
-      "CtrlHome" = "CursorStart";
-      "CtrlPageDown" = "NextTab";
-      "CtrlPageUp" = "PreviousTab";
-      "AltPageDown" = "NextTab";
-      "AltPageUp" = "PreviousTab";
-      "CtrlShiftDown" = "SelectToEnd";
-      "CtrlShiftLeft" = "SelectWordLeft";
-      "CtrlShiftRight" = "SelectWordRight";
-      "CtrlShiftUp" = "SelectToStart";
-      "CtrlUp" = "CursorStart";
-      "Delete" = "Delete";
-      "Down" = "CursorDown";
-      "End" = "EndOfLine";
-      "Enter" = "InsertNewline";
-      "Esc" = "Escape";
-      "F10" = "Quit";
-      "F2" = "Save";
-      "F3" = "Find";
-      "F4" = "Quit";
-      "F7" = "Find";
-      "Home" = "StartOfText";
-      "Insert" = "ToggleOverwriteMode";
-      "Left" = "CursorLeft";
-      "MouseLeft" = "MousePress";
-      "MouseLeftDrag" = "MouseDrag";
-      "MouseLeftRelease" = "MouseRelease";
-      "MouseMiddle" = "PastePrimary";
-      "MouseWheelDown" = "ScrollDown";
-      "MouseWheelUp" = "ScrollUp";
-      "PageDown" = "CursorPageDown";
-      "PageUp" = "CursorPageUp";
-      "Right" = "CursorRight";
-      "ShiftDown" = "SelectDown";
-      "ShiftEnd" = "SelectToEndOfLine";
-      "ShiftHome" = "SelectToStartOfTextToggle";
-      "ShiftLeft" = "SelectLeft";
-      "ShiftPageDown" = "SelectPageDown";
-      "ShiftPageUp" = "SelectPageUp";
-      "ShiftRight" = "SelectRight";
-      "ShiftUp" = "SelectUp";
-      "Tab" = "Autocomplete|IndentSelection|InsertTab";
-      "Up" = "CursorUp";
+  config.home = {
+    sessionVariables.EDITOR = "micro";
+    shellAliases.nano = "micro";
+    file = {
+      # keybindings
+      "${config.xdg.configHome}/micro/bindings.json".source = pkgs.writeText "micro-keybindings.json" (builtins.toJSON {
+        "Alt-," = "PreviousTab";
+        "Alt-." = "NextTab";
+        "Alt-Backspace" = "DeleteWordLeft";
+        "Alt-CtrlH" = "DeleteWordLeft";
+        "Alt-F" = "FindLiteral";
+        "Alt-[" = "DiffPrevious|CursorStart";
+        "Alt-]" = "DiffNext|CursorEnd";
+        "Alt-a" = "StartOfLine";
+        "Alt-b" = "WordLeft";
+        "Alt-c" = "RemoveAllMultiCursors";
+        "Alt-e" = "EndOfLine";
+        "Alt-f" = "WordRight";
+        "Alt-g" = "ToggleKeyMenu";
+        "Alt-m" = "SpawnMultiCursorSelect";
+        "Alt-n" = "SpawnMultiCursor";
+        "Alt-p" = "RemoveMultiCursor";
+        "Alt-x" = "SkipMultiCursor";
+        "Alt-{" = "ParagraphPrevious";
+        "Alt-}" = "ParagraphNext";
+        "AltDown" = "MoveLinesDown";
+        "AltLeft" = "StartOfTextToggle";
+        "AltRight" = "EndOfLine";
+        "AltShiftDown" = "SpawnMultiCursorDown";
+        "AltShiftLeft" = "SelectToStartOfTextToggle";
+        "AltShiftRight" = "SelectToEndOfLine";
+        "AltShiftUp" = "SpawnMultiCursorUp";
+        "AltUp" = "MoveLinesUp";
+        "Backspace" = "Backspace";
+        "Backtab" = "OutdentSelection|OutdentLine";
+        "Ctrl-MouseLeft" = "MouseMultiCursor";
+        "Ctrl-a" = "SelectAll";
+        "Ctrl-b" = "ShellMode";
+        "Ctrl-c" = "Copy|CopyLine";
+        "Ctrl-d" = "DuplicateLine";
+        "Ctrl-e" = "CommandMode";
+        "Ctrl-f" = "Find";
+        "Ctrl-g" = "ToggleHelp";
+        "Ctrl-h" = "Backspace";
+        "Ctrl-j" = "PlayMacro";
+        "Ctrl-k" = "CutLine";
+        "Ctrl-l" = "command-edit:goto ";
+        "Ctrl-n" = "FindNext";
+        "Ctrl-o" = "OpenFile";
+        "Ctrl-p" = "FindPrevious";
+        "Ctrl-q" = "Quit";
+        "Ctrl-r" = "ToggleRuler";
+        "Ctrl-s" = "Save";
+        "Ctrl-t" = "AddTab";
+        "Ctrl-u" = "ToggleMacro";
+        "Ctrl-v" = "Paste";
+        "Ctrl-w" = "NextSplit";
+        "Ctrl-x" = "Cut|CutLine";
+        "Ctrl-y" = "Redo";
+        "Ctrl-z" = "Undo";
+        "CtrlDown" = "CursorEnd";
+        "CtrlEnd" = "CursorEnd";
+        "CtrlHome" = "CursorStart";
+        "CtrlPageDown" = "NextTab";
+        "CtrlPageUp" = "PreviousTab";
+        "AltPageDown" = "NextTab";
+        "AltPageUp" = "PreviousTab";
+        "CtrlShiftDown" = "SelectToEnd";
+        "CtrlShiftLeft" = "SelectWordLeft";
+        "CtrlShiftRight" = "SelectWordRight";
+        "CtrlShiftUp" = "SelectToStart";
+        "CtrlUp" = "CursorStart";
+        "Delete" = "Delete";
+        "Down" = "CursorDown";
+        "End" = "EndOfLine";
+        "Enter" = "InsertNewline";
+        "Esc" = "Escape";
+        "F10" = "Quit";
+        "F2" = "Save";
+        "F3" = "Find";
+        "F4" = "Quit";
+        "F7" = "Find";
+        "Home" = "StartOfText";
+        "Insert" = "ToggleOverwriteMode";
+        "Left" = "CursorLeft";
+        "MouseLeft" = "MousePress";
+        "MouseLeftDrag" = "MouseDrag";
+        "MouseLeftRelease" = "MouseRelease";
+        "MouseMiddle" = "PastePrimary";
+        "MouseWheelDown" = "ScrollDown";
+        "MouseWheelUp" = "ScrollUp";
+        "PageDown" = "CursorPageDown";
+        "PageUp" = "CursorPageUp";
+        "Right" = "CursorRight";
+        "ShiftDown" = "SelectDown";
+        "ShiftEnd" = "SelectToEndOfLine";
+        "ShiftHome" = "SelectToStartOfTextToggle";
+        "ShiftLeft" = "SelectLeft";
+        "ShiftPageDown" = "SelectPageDown";
+        "ShiftPageUp" = "SelectPageUp";
+        "ShiftRight" = "SelectRight";
+        "ShiftUp" = "SelectUp";
+        "Tab" = "Autocomplete|IndentSelection|InsertTab";
+        "Up" = "CursorUp";
+
+        # plugins
+        "Alt-/" = "lua:comment.comment";
+        "Alt-d" = "command:definition";
+  #      "Alt-f" = "command:format";
+        "Alt-k" = "command:hover";
+        "Alt-r" = "command:references";
+        "CtrlSpace" = "command:lspcompletion";
+        "CtrlUnderscore" = "lua:comment.comment";
+        "F1" = "command:cheat";
+  #      "F4" = "command:jumptag";
+        "F5" = "lua:wc.wordCount";
+      });
 
       # plugins
-      "Alt-/" = "lua:comment.comment";
-      "Alt-d" = "command:definition";
-#      "Alt-f" = "command:format";
-      "Alt-k" = "command:hover";
-      "Alt-r" = "command:references";
-      "CtrlSpace" = "command:lspcompletion";
-      "CtrlUnderscore" = "lua:comment.comment";
-      "F1" = "command:cheat";
-#      "F4" = "command:jumptag";
-      "F5" = "lua:wc.wordCount";
-    });
-
-    # plugins
-    "${config.xdg.configHome}/micro/plug/lsp".source = pkgs.fetchFromGitHub {
-      owner = "AndCake";
-      repo = "micro-plugin-lsp";
-      rev = "v0.6.3";
-      sha256 = "sha256-rZ9Vw9WPGNaJBGHKU40F6cBIYQ1JFtSKPDrheazKkPY=";
-    };
+      "${config.xdg.configHome}/micro/plug/lsp".source = pkgs.fetchFromGitHub {
+        owner = "AndCake";
+        repo = "micro-plugin-lsp";
+        rev = "v0.6.3";
+        sha256 = "sha256-rZ9Vw9WPGNaJBGHKU40F6cBIYQ1JFtSKPDrheazKkPY=";
+      };
 
-    "${config.xdg.configHome}/micro/plug/detectindent".source = pkgs.fetchFromGitHub {
-      owner = "dmaluka";
-      repo = "micro-detectindent";
-      rev = "v1.1.0";
-      sha256 = "sha256-5bKEkOnhz0pyBR2UNw5vvYiTtpd96fBPTYW9jnETvq4=";
-    };
+      "${config.xdg.configHome}/micro/plug/detectindent".source = pkgs.fetchFromGitHub {
+        owner = "dmaluka";
+        repo = "micro-detectindent";
+        rev = "v1.1.0";
+        sha256 = "sha256-5bKEkOnhz0pyBR2UNw5vvYiTtpd96fBPTYW9jnETvq4=";
+      };
 
-    "${config.xdg.configHome}/micro/plug/wc".source = pkgs.fetchFromGitHub {
-      owner = "adamnpeace";
-      repo = "micro-wc-plugin";
-      rev = "b2c9957e521770eadc1ecae9d54c0a30f40a0a3d";
-      sha256 = "sha256-Z6MC2cet8+7XHv41G+SlAZViCqlh/9dk0CSt7HklnTg=";
+      "${config.xdg.configHome}/micro/plug/wc".source = pkgs.fetchFromGitHub {
+        owner = "adamnpeace";
+        repo = "micro-wc-plugin";
+        rev = "b2c9957e521770eadc1ecae9d54c0a30f40a0a3d";
+        sha256 = "sha256-Z6MC2cet8+7XHv41G+SlAZViCqlh/9dk0CSt7HklnTg=";
+      };
     };
   };
 
-  programs.sherlock.settings.ignore = "Micro";
 
 }
diff --git a/config/nixos/modules/users/zaphyra.nix b/config/nixos/modules/users/zaphyra.nix
@@ -68,6 +68,7 @@ in
               programs.gpg
               homeManagerModules.common.programs.gpg
 
+              programs.languages.nix
               programs.languages.nimlang
               programs.languages.golang
               programs.languages.javascript