This commit is contained in:
2024-11-18 00:28:37 +01:00
parent 9e97dc6f65
commit fec28354bd
13 changed files with 634 additions and 291 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ let
open-vsx.ms-azuretools.vscode-docker
open-vsx.webfreak.debug
open-vsx.mkhl.direnv
vscode-marketplace.ms-vscode-remote.remote-ssh
vscode-marketplace.ms-vscode-remote.remote-wsl
vscode-marketplace.ms-vscode-remote.remote-containers
open-vsx.esbenp.prettier-vscode
open-vsx.formulahendry.code-runner
@@ -95,7 +95,7 @@ let
"nix.enableLanguageServer" = lib.mkDefault true;
"nix.serverPath" = lib.mkDefault "${pkgs.nixd}/bin/nixd";
"nix.formatterPath" = lib.mkDefault "${pkgs.nixfmt-classic}/bin/nixfmt";
"nix.formatterPath" = lib.mkDefault "${pkgs.nixfmt-rfc-style}/bin/nixfmt";
"nix.serverSettings" = {
"nixd" = { "formatting" = { "command" = lib.mkDefault [ "nixfmt" ]; }; };
};
@@ -1,30 +1,35 @@
{ config, lib, pkgs, materusArg, materusCfg, ... }:
{
config,
lib,
pkgs,
materusArg,
materusCfg,
...
}:
let
emacs-git =
materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-git;
emacs-pkg = materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-unstable;
materus-config = e:
materus-config =
e:
e.trivialBuild {
pname = "materus-config";
src = pkgs.writeText "materus-config.el" ''
(when (file-exists-p "${config.programs.emacs.package}/opt/emacs/buildtime")
(setq emacs-build-time (decode-time (seconds-to-time (string-to-number (with-temp-buffer
(insert-file-contents "${config.programs.emacs.package}/opt/emacs/buildtime")
(buffer-string)))))))
(setq emacs-build-time (decode-time (seconds-to-time (string-to-number (with-temp-buffer
(insert-file-contents "${config.programs.emacs.package}/opt/emacs/buildtime")
(buffer-string)))))))
(provide 'materus-config)
'';
version = "1.0.0";
};
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
packages = epkgs:
with epkgs; [
packages =
epkgs: with epkgs; [
(materus-config epkgs)
treesit-grammars.with-all-grammars
use-package
elcord
persp-mode
dashboard
magit
git-timemachine
@@ -37,17 +42,17 @@ let
iedit
hideshowvis
evil
perspective
treemacs-evil
treemacs
treemacs-nerd-icons
treemacs-perspective
treemacs-nerd-icons
treemacs-icons-dired
treemacs-magit
treemacs-projectile
tree-edit
nerd-icons
nerd-icons-completion
perspective
minions
rainbow-delimiters
rainbow-mode
@@ -56,6 +61,8 @@ let
lsp-java
lsp-jedi
lsp-haskell
lsp-pascal
lsp-pyright
lsp-ui
lsp-treemacs
dap-mode
@@ -81,6 +88,8 @@ let
markdown-mode
json-mode
nix-mode
nixfmt
nix-ts-mode
no-littering
right-click-context
dracula-theme
@@ -93,7 +102,6 @@ let
yasnippet
async
request
nix-ts-mode
markdown-ts-mode
llvm-ts-mode
treesit-fold
@@ -113,6 +121,7 @@ let
drag-stuff
dirvish
rg
shfmt
# Completions & Minibuffer
corfu
company
@@ -128,11 +137,13 @@ let
emacsEnv = pkgs.buildEnv {
name = "emacs-env";
paths = with pkgs; [
pyright
shfmt
ripgrep
cmake
gnumake
nixfmt-classic
python3
nixfmt-rfc-style
python3Full
lua
multimarkdown
git
@@ -142,10 +153,11 @@ let
llvmPackages.lldb
(hiPrio gcc)
gdb
nixd
materusArg.unstable.nixd
jdt-language-server
jdk
gradle
fpc
omnisharp-roslyn
];
};
@@ -153,15 +165,23 @@ let
cfg = config.materus.profile.editor.emacs;
setNixInit = ''
(defvar lsp-java-configuration-runtimes nil)
(setq lsp-java-configuration-runtimes '[(:name "JavaSE-1.8"
:path "${pkgs.jdk8}/lib/openjdk/")
(:name "JavaSE-17"
:path "${pkgs.jdk17}/lib/openjdk/")
(:name "JavaSE-21"
:path "${pkgs.jdk21}/lib/openjdk/"
:default t)])
(setq lsp-nix-nixd-nixos-options-expr (concat "(builtins.getFlake \"/etc/nixos\").nixosConfigurations." (system-name) ".options"))
(setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin"))
(setenv "LD_LIBRARY_PATH" (concat (getenv "LD_LIBRARY_PATH") ":${emacsEnv}/lib"))
(setq exec-path (append exec-path '("${emacsEnv}/bin")))
(call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 148 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0)
(call-process-shell-command "${pkgs.xorg.xmodmap}/bin/xmodmap -e \"keycode 66 = Hyper_L\" -e \"remove Mod4 = Hyper_L\" -e \"add Mod3 = Hyper_L\" &" nil 0)
'';
in {
options.materus.profile.editor.emacs.enable =
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
in
{
options.materus.profile.editor.emacs.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
config = lib.mkIf cfg.enable {
home.activation.emacsSetup = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
@@ -172,29 +192,34 @@ in {
run ${config.programs.emacs.finalPackage}/bin/emacs -Q --batch \
--eval '(setq warning-minimum-log-level :error)' \
--eval '(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))' \
--eval '(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))' \
--eval '(package-initialize)' \
--eval '(byte-recompile-directory (concat user-emacs-directory "etc/materus/extra") 0 t)' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/nix-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")'
--eval '(setq warning-minimum-log-level :error)' \
--eval '(setq package-user-dir (concat user-emacs-directory "var/elpa/" emacs-version "/" ))' \
--eval '(setq package-gnupghome-dir (concat user-emacs-directory "var/elpa/gnupg/" ))' \
--eval '(package-initialize)' \
--eval '(byte-recompile-directory (concat user-emacs-directory "etc/materus/extra") 0 t)' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/nix-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")'
'';
xdg.configFile = { "emacs/nix-init.el".text = setNixInit; };
xdg.configFile = {
"emacs/etc/materus/nix-init.el".text = setNixInit;
};
#Emacsclient with COLORTERM env variable, without it display in "-nw" client is broken
xdg.desktopEntries.emacs = {
name = "Emacs";
genericName = "Edytor tekstu";
comment = "Edytuj tekst";
exec = ''env COLORTERM=truecolor emacsclient -a "" -r -n %F'';
exec = ''env COLORTERM=truecolor emacsclient -a "" -r %F'';
icon = "emacs";
terminal = false;
type = "Application";
categories = [ "Development" "TextEditor" ];
categories = [
"Development"
"TextEditor"
];
mimeType = [
"text/english"
"text/plain"
@@ -214,7 +239,7 @@ in {
"x-scheme-handler/org-protocol"
];
actions.new-window = {
exec = ''env COLORTERM=truecolor emacsclient -a "" -c -n %F'';
exec = ''env COLORTERM=truecolor emacsclient -a "" -c %F'';
name = "Nowe okno";
};
actions.no-daemon = {
@@ -225,35 +250,118 @@ in {
programs.emacs = {
enable = true;
package = lib.mkDefault ((emacs-git.override {
withSQLite3 = true;
withWebP = true;
withX = true;
#withXwidgets = true;
withGTK3 = true;
withAlsaLib = true;
withGconf = true;
withImageMagick = true;
}).overrideAttrs (f: p: {
#Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca
postInstall = p.postInstall + ''
rm -fr $out/share/applications/*
mkdir -p $out/opt/emacs
date +%s | tr -d '\n' > $out/opt/emacs/buildtime
'';
}));
extraPackages = epkgs:
(packages (epkgs.overrideScope (ff: pp: {
#Build lsp-mode with plist support, need to set this in emacs too
lsp-mode = (pp.lsp-mode.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-java = (pp.lsp-java.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-jedi= (pp.lsp-jedi.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-haskell = (pp.lsp-haskell.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-ui = (pp.lsp-ui.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
lsp-treemacs = (pp.lsp-treemacs.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
dap-mode = (pp.dap-mode.overrideAttrs (f: p: { buildPhase = "export LSP_USE_PLISTS=true\n" + p.buildPhase;}));
})));
package = lib.mkDefault (
(emacs-pkg.override {
withSQLite3 = true;
withWebP = true;
withX = true;
#withXwidgets = true;
withGTK3 = true;
withAlsaLib = true;
withGconf = true;
withImageMagick = true;
}).overrideAttrs
(
f: p: {
#Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca
postInstall =
p.postInstall
+ ''
rm -fr $out/share/applications/*
mkdir -p $out/opt/emacs
date +%s | tr -d '\n' > $out/opt/emacs/buildtime
'';
}
)
);
extraPackages =
epkgs:
(packages (
epkgs.overrideScope (
ff: pp: {
#Build lsp-mode with plist support, need to set this in emacs too
lsp-mode = (
pp.lsp-mode.overrideAttrs (
f: p: {
patches = [ ./lsp-mode.patch ];
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-java = (
pp.lsp-java.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-jedi = (
pp.lsp-jedi.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-haskell = (
pp.lsp-haskell.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-ui = (
pp.lsp-ui.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
lsp-treemacs = (
pp.lsp-treemacs.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
dap-mode = (
pp.dap-mode.overrideAttrs (
f: p: {
buildPhase =
''
export LSP_USE_PLISTS=true
''
+ p.buildPhase;
}
)
);
}
)
));
};
};
@@ -0,0 +1,22 @@
From 75e41ae5bd1c0879b323ed0ddc4bac29badb29ff Mon Sep 17 00:00:00 2001
From: fanshi1028 <jackychany321@gmail.com>
Date: Fri, 1 Nov 2024 14:41:26 +0000
Subject: [PATCH] fix lsp-org breaks with org 9.7 (#4300)
---
lsp-mode.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lsp-mode.el b/lsp-mode.el
index f5c700dbf3..a149d6d2c7 100644
--- a/lsp-mode.el
+++ b/lsp-mode.el
@@ -9668,7 +9668,7 @@ defaults to `progress-bar."
(save-excursion
(funcall goto-buffer)
(funcall f))))))
- ((&plist :begin :end :post-blank :language) (cl-second (org-element-context)))
+ ((begin end post-blank language) (--map (org-element-property it (org-element-context) nil t) '(:begin :end :post-blank :language)))
((&alist :tangle file-name) (cl-third (org-babel-get-src-block-info 'light)))
(file-name (if file-name