2024-11-10 11:50:21 +01:00
|
|
|
{ config, lib, pkgs, materusArg, materusCfg, ... }:
|
2023-10-08 11:42:08 +02:00
|
|
|
let
|
2024-11-10 11:50:21 +01:00
|
|
|
emacs-git =
|
|
|
|
materusCfg.configInputs.emacs-overlay.packages.x86_64-linux.emacs-git;
|
|
|
|
|
|
|
|
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)))))))
|
|
|
|
(provide 'materus-config)
|
|
|
|
'';
|
|
|
|
version = "1.0.0";
|
|
|
|
};
|
|
|
|
|
2024-03-11 16:19:31 +01:00
|
|
|
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
|
2024-10-28 16:31:39 +01:00
|
|
|
packages = epkgs:
|
|
|
|
with epkgs; [
|
2024-11-10 11:50:21 +01:00
|
|
|
(materus-config epkgs)
|
|
|
|
treesit-grammars.with-all-grammars
|
2023-11-13 00:44:03 +01:00
|
|
|
|
2024-11-15 18:01:13 +01:00
|
|
|
use-package
|
|
|
|
elcord
|
|
|
|
persp-mode
|
|
|
|
dashboard
|
|
|
|
magit
|
|
|
|
git-timemachine
|
|
|
|
avy
|
|
|
|
vterm
|
|
|
|
direnv
|
|
|
|
projectile
|
|
|
|
clipetty
|
|
|
|
which-key
|
|
|
|
iedit
|
|
|
|
hideshowvis
|
|
|
|
evil
|
|
|
|
treemacs-evil
|
|
|
|
treemacs
|
|
|
|
treemacs-nerd-icons
|
|
|
|
treemacs-perspective
|
|
|
|
treemacs-icons-dired
|
|
|
|
treemacs-magit
|
|
|
|
treemacs-projectile
|
|
|
|
tree-edit
|
|
|
|
nerd-icons
|
|
|
|
nerd-icons-completion
|
|
|
|
perspective
|
|
|
|
minions
|
|
|
|
rainbow-delimiters
|
|
|
|
rainbow-mode
|
|
|
|
cmake-mode
|
|
|
|
lsp-mode
|
|
|
|
lsp-java
|
|
|
|
lsp-jedi
|
|
|
|
lsp-haskell
|
|
|
|
lsp-ui
|
|
|
|
lsp-treemacs
|
|
|
|
dap-mode
|
|
|
|
flycheck
|
|
|
|
gradle-mode
|
|
|
|
groovy-mode
|
|
|
|
kotlin-mode
|
|
|
|
d-mode
|
|
|
|
lua-mode
|
|
|
|
multiple-cursors
|
|
|
|
org
|
|
|
|
org-contrib
|
|
|
|
org-ql
|
|
|
|
org-rainbow-tags
|
|
|
|
org-roam
|
|
|
|
org-roam-ui
|
|
|
|
org-review
|
|
|
|
org-present
|
|
|
|
org-superstar
|
|
|
|
org-auto-tangle
|
|
|
|
visual-fill-column
|
|
|
|
csharp-mode
|
|
|
|
markdown-mode
|
|
|
|
json-mode
|
|
|
|
nix-mode
|
|
|
|
no-littering
|
|
|
|
right-click-context
|
|
|
|
dracula-theme
|
|
|
|
doom-themes
|
|
|
|
doom-modeline
|
|
|
|
popper
|
|
|
|
undo-tree
|
|
|
|
bash-completion
|
|
|
|
eldoc-box
|
|
|
|
yasnippet
|
|
|
|
async
|
|
|
|
request
|
|
|
|
nix-ts-mode
|
|
|
|
markdown-ts-mode
|
|
|
|
llvm-ts-mode
|
|
|
|
treesit-fold
|
|
|
|
treesit-auto
|
|
|
|
tree-sitter-langs
|
|
|
|
eat
|
|
|
|
vlf
|
|
|
|
edit-indirect
|
|
|
|
zones
|
|
|
|
sudo-edit
|
|
|
|
toc-org
|
|
|
|
empv
|
|
|
|
volatile-highlights
|
|
|
|
highlight
|
|
|
|
elfeed
|
|
|
|
elfeed-goodies
|
|
|
|
drag-stuff
|
|
|
|
dirvish
|
|
|
|
rg
|
|
|
|
# Completions & Minibuffer
|
|
|
|
corfu
|
|
|
|
company
|
|
|
|
company-quickhelp
|
|
|
|
cape
|
|
|
|
embark
|
|
|
|
embark-consult
|
|
|
|
orderless
|
|
|
|
vertico
|
|
|
|
marginalia
|
|
|
|
];
|
2023-11-13 00:44:03 +01:00
|
|
|
|
2024-10-29 13:15:12 +01:00
|
|
|
emacsEnv = pkgs.buildEnv {
|
|
|
|
name = "emacs-env";
|
|
|
|
paths = with pkgs; [
|
2024-11-15 18:01:13 +01:00
|
|
|
ripgrep
|
|
|
|
cmake
|
|
|
|
gnumake
|
2024-11-10 11:50:21 +01:00
|
|
|
nixfmt-classic
|
2024-10-29 13:15:12 +01:00
|
|
|
python3
|
|
|
|
lua
|
|
|
|
multimarkdown
|
|
|
|
git
|
|
|
|
emacs-lsp-booster
|
|
|
|
llvmPackages.clang-tools
|
|
|
|
llvmPackages.clang
|
|
|
|
llvmPackages.lldb
|
|
|
|
(hiPrio gcc)
|
|
|
|
gdb
|
|
|
|
nixd
|
|
|
|
jdt-language-server
|
2024-11-15 18:01:13 +01:00
|
|
|
jdk
|
|
|
|
gradle
|
2024-10-29 13:15:12 +01:00
|
|
|
omnisharp-roslyn
|
|
|
|
];
|
|
|
|
};
|
2023-11-15 00:07:16 +01:00
|
|
|
|
|
|
|
cfg = config.materus.profile.editor.emacs;
|
|
|
|
|
2023-11-13 00:44:03 +01:00
|
|
|
setNixInit = ''
|
2024-10-29 13:15:12 +01:00
|
|
|
(setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin"))
|
2024-11-15 18:01:13 +01:00
|
|
|
(setenv "LD_LIBRARY_PATH" (concat (getenv "LD_LIBRARY_PATH") ":${emacsEnv}/lib"))
|
2024-10-29 13:15:12 +01:00
|
|
|
(setq exec-path (append exec-path '("${emacsEnv}/bin")))
|
2024-10-28 16:31:39 +01:00
|
|
|
(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)
|
2024-11-03 14:03:17 +01:00
|
|
|
(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)
|
2023-11-13 00:44:03 +01:00
|
|
|
'';
|
2024-11-10 11:50:21 +01:00
|
|
|
in {
|
2024-10-28 16:31:39 +01:00
|
|
|
options.materus.profile.editor.emacs.enable =
|
|
|
|
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
|
2023-11-13 00:44:03 +01:00
|
|
|
|
|
|
|
config = lib.mkIf cfg.enable {
|
2024-11-15 18:01:13 +01:00
|
|
|
home.activation.emacsSetup = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
|
2024-10-28 16:31:39 +01:00
|
|
|
mkdir -p ${config.xdg.configHome}/emacs/var/recovery
|
2024-11-15 18:01:13 +01:00
|
|
|
mkdir -p ${config.xdg.configHome}/emacs/etc/materus
|
2024-11-10 11:50:21 +01:00
|
|
|
mkdir -p ${config.xdg.configHome}/emacs/var/backups
|
2024-11-15 18:01:13 +01:00
|
|
|
${pkgs.rsync}/bin/rsync -zr --no-times --chmod=744 "${configPath}" "${config.xdg.configHome}/emacs"
|
|
|
|
|
|
|
|
|
|
|
|
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")'
|
2023-11-14 23:25:05 +01:00
|
|
|
'';
|
2023-11-15 00:07:16 +01:00
|
|
|
|
2024-11-15 18:01:13 +01:00
|
|
|
xdg.configFile = { "emacs/nix-init.el".text = setNixInit; };
|
|
|
|
|
|
|
|
#Emacsclient with COLORTERM env variable, without it display in "-nw" client is broken
|
2024-11-10 11:50:21 +01:00
|
|
|
xdg.desktopEntries.emacs = {
|
|
|
|
name = "Emacs";
|
|
|
|
genericName = "Edytor tekstu";
|
|
|
|
comment = "Edytuj tekst";
|
2024-11-11 01:22:14 +01:00
|
|
|
exec = ''env COLORTERM=truecolor emacsclient -a "" -r -n %F'';
|
2024-11-10 11:50:21 +01:00
|
|
|
icon = "emacs";
|
|
|
|
terminal = false;
|
|
|
|
type = "Application";
|
|
|
|
categories = [ "Development" "TextEditor" ];
|
|
|
|
mimeType = [
|
|
|
|
"text/english"
|
|
|
|
"text/plain"
|
|
|
|
"text/x-makefile"
|
|
|
|
"text/x-c++hdr"
|
|
|
|
"text/x-c++src"
|
|
|
|
"text/x-chdr"
|
|
|
|
"text/x-csrc"
|
|
|
|
"text/x-java"
|
|
|
|
"text/x-moc"
|
|
|
|
"text/x-pascal"
|
|
|
|
"text/x-tcl"
|
|
|
|
"text/x-tex"
|
|
|
|
"application/x-shellscript"
|
|
|
|
"text/x-c"
|
|
|
|
"text/x-c++"
|
|
|
|
"x-scheme-handler/org-protocol"
|
|
|
|
];
|
|
|
|
actions.new-window = {
|
2024-11-11 01:22:14 +01:00
|
|
|
exec = ''env COLORTERM=truecolor emacsclient -a "" -c -n %F'';
|
2024-11-10 11:50:21 +01:00
|
|
|
name = "Nowe okno";
|
|
|
|
};
|
|
|
|
actions.no-daemon = {
|
|
|
|
exec = "env COLORTERM=truecolor emacs %F";
|
|
|
|
name = "Instancja samodzielna";
|
|
|
|
};
|
2024-10-30 14:09:43 +01:00
|
|
|
};
|
2023-11-15 00:07:16 +01:00
|
|
|
|
2023-11-13 00:44:03 +01:00
|
|
|
programs.emacs = {
|
|
|
|
enable = true;
|
2024-11-10 11:50:21 +01:00
|
|
|
package = lib.mkDefault ((emacs-git.override {
|
|
|
|
withSQLite3 = true;
|
|
|
|
withWebP = true;
|
|
|
|
withX = true;
|
2024-11-15 18:01:13 +01:00
|
|
|
#withXwidgets = true;
|
2024-11-10 11:50:21 +01:00
|
|
|
withGTK3 = true;
|
|
|
|
withAlsaLib = true;
|
|
|
|
withGconf = true;
|
|
|
|
withImageMagick = true;
|
|
|
|
}).overrideAttrs (f: p: {
|
2024-11-15 18:01:13 +01:00
|
|
|
#Remove .desktop files, will use my own. Add file with buildtime in case of using elpaca
|
2024-11-10 11:50:21 +01:00
|
|
|
postInstall = p.postInstall + ''
|
|
|
|
rm -fr $out/share/applications/*
|
|
|
|
mkdir -p $out/opt/emacs
|
|
|
|
date +%s | tr -d '\n' > $out/opt/emacs/buildtime
|
|
|
|
'';
|
|
|
|
}));
|
2024-11-15 18:01:13 +01:00
|
|
|
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;}));
|
|
|
|
})));
|
2023-10-25 15:34:43 +02:00
|
|
|
};
|
2023-10-08 11:42:08 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
}
|