mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-27 10:26:58 +02:00
fix: emacs - formatting nix code via alejandra
This commit is contained in:
@@ -22,8 +22,8 @@ with lib; let
|
|||||||
e = "emacsclient --create-frame"; # gui
|
e = "emacsclient --create-frame"; # gui
|
||||||
et = "emacsclient --create-frame --tty"; # termimal
|
et = "emacsclient --create-frame --tty"; # termimal
|
||||||
};
|
};
|
||||||
librime-dir = "${config.xdg.dataHome}/librime";
|
librime-dir = "${config.xdg.dataHome}/emacs/librime";
|
||||||
parinfer-rust-lib-dir = "${config.xdg.dataHome}/parinfer-rust";
|
parinfer-rust-lib-dir = "${config.xdg.dataHome}/emacs/parinfer-rust";
|
||||||
in {
|
in {
|
||||||
options.modules.editors.emacs = {
|
options.modules.editors.emacs = {
|
||||||
enable = mkEnableOption "Emacs Editor";
|
enable = mkEnableOption "Emacs Editor";
|
||||||
@@ -69,10 +69,16 @@ in {
|
|||||||
force = true;
|
force = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg.configFile."emacs/lsp-bridge-user-langserver" = {
|
||||||
|
source = ./lsp-bridge-user-langserver;
|
||||||
|
force = true;
|
||||||
|
};
|
||||||
|
|
||||||
home.activation.installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
home.activation.installDoomEmacs = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/
|
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${doomemacs}/ ${config.xdg.configHome}/emacs/
|
||||||
|
|
||||||
# librime for emacs-rime
|
# librime for emacs-rime
|
||||||
|
mkdir -p ${librime-dir}
|
||||||
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.librime}/ ${librime-dir}/
|
${pkgs.rsync}/bin/rsync -avz --chmod=D2755,F744 ${pkgs.librime}/ ${librime-dir}/
|
||||||
|
|
||||||
# libparinfer_rust for emacs' parinfer-rust-mode
|
# libparinfer_rust for emacs' parinfer-rust-mode
|
||||||
|
|||||||
@@ -90,7 +90,10 @@
|
|||||||
|
|
||||||
(use-package! lsp-bridge
|
(use-package! lsp-bridge
|
||||||
:config
|
:config
|
||||||
(setq lsp-bridge-enable-log nil)
|
(setq lsp-bridge-enable-log nil) ;; disabled for performance
|
||||||
|
;; for user's custom langserver file
|
||||||
|
(setq lsp-bridge-user-langserver-dir "~/.config/emacs/lsp-bridge-user-langserver")
|
||||||
|
(setq lsp-bridge-enable-auto-format-code 1)
|
||||||
(global-lsp-bridge-mode))
|
(global-lsp-bridge-mode))
|
||||||
|
|
||||||
(use-package! wakatime-mode :ensure t)
|
(use-package! wakatime-mode :ensure t)
|
||||||
@@ -104,14 +107,14 @@
|
|||||||
(global-font-lock-mode 0))
|
(global-font-lock-mode 0))
|
||||||
|
|
||||||
;; use alejandra to format nix files
|
;; use alejandra to format nix files
|
||||||
(use-package! lsp-nix
|
;; (use-package! lsp-nix
|
||||||
:ensure lsp-mode
|
;; :ensure lsp-mode
|
||||||
:after
|
;; :after
|
||||||
(lsp-mode)
|
;; (lsp-mode)
|
||||||
:demand t
|
;; :demand t
|
||||||
:custom
|
;; :custom
|
||||||
(lsp-nix-nil-formatter
|
;; (lsp-nix-nil-formatter
|
||||||
["alejandra"]))
|
;; ["alejandra"]))
|
||||||
(use-package! nushell-mode
|
(use-package! nushell-mode
|
||||||
:config
|
:config
|
||||||
(setq nushell-enable-auto-indent 1))
|
(setq nushell-enable-auto-indent 1))
|
||||||
@@ -120,7 +123,7 @@
|
|||||||
(use-package! rime
|
(use-package! rime
|
||||||
:custom
|
:custom
|
||||||
(default-input-method "rime")
|
(default-input-method "rime")
|
||||||
(rime-librime-root "~/.local/share/librime"))
|
(rime-librime-root "~/.local/share/emacs/librime"))
|
||||||
|
|
||||||
;; use parinfer for lisp editing
|
;; use parinfer for lisp editing
|
||||||
(use-package! parinfer-rust-mode
|
(use-package! parinfer-rust-mode
|
||||||
@@ -136,7 +139,7 @@
|
|||||||
;; fix: https://github.com/doomemacs/doomemacs/issues/6163
|
;; fix: https://github.com/doomemacs/doomemacs/issues/6163
|
||||||
(setq parinfer-rust-auto-download 0)
|
(setq parinfer-rust-auto-download 0)
|
||||||
;; we need to download it manually and put it in this path
|
;; we need to download it manually and put it in this path
|
||||||
(setq parinfer-rust-library "~/.local/share/parinfer-rust/parinfer-rust.so")
|
(setq parinfer-rust-library "~/.local/share/emacs/parinfer-rust/parinfer-rust.so")
|
||||||
:config
|
:config
|
||||||
(map! :map parinfer-rust-mode-map
|
(map! :map parinfer-rust-mode-map
|
||||||
:localleader
|
:localleader
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"name": "nil",
|
||||||
|
"languageId": "nix",
|
||||||
|
"command": ["nil"],
|
||||||
|
"settings": {
|
||||||
|
"nil": {
|
||||||
|
"formatting": { "command": ["alejandra"] }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user