nixos-config/configurations/profile/home/editor/emacs/default.nix

149 lines
3.6 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, materusArg, ... }:
2023-10-08 11:42:08 +02:00
let
2024-03-11 16:19:31 +01:00
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
inits = import ./init.nix {
path = configPath;
inherit pkgs;
};
packages = epkgs:
with epkgs; [
elcord
persp-mode
dashboard
magit
avy
corfu
vterm
projectile
company
clipetty
2024-10-29 13:15:12 +01:00
which-key
iedit
hideshowvis
2024-10-29 13:15:12 +01:00
evil
treemacs-evil
treemacs
treemacs-nerd-icons
treemacs-perspective
treemacs-icons-dired
treemacs-magit
treemacs-projectile
tree-edit
vertico
2024-10-30 16:37:59 +01:00
marginalia
nerd-icons
nerd-icons-completion
perspective
minions
telephone-line
rainbow-delimiters
use-package
cmake-mode
lsp-mode
lsp-java
lsp-jedi
lsp-haskell
lsp-ui
lsp-treemacs
dap-mode
d-mode
2024-10-29 13:15:12 +01:00
lua-mode
multiple-cursors
org
org-rainbow-tags
org-roam
org-roam-ui
org-review
2024-10-29 13:15:12 +01:00
csharp-mode
markdown-mode
json-mode
nix-mode
no-littering
2024-10-29 13:15:12 +01:00
right-click-context
2024-11-03 14:03:17 +01:00
dracula-theme
doom-themes
2024-10-30 16:37:59 +01:00
orderless
2024-11-03 14:03:17 +01:00
popper
undo-tree
bash-completion
consult
];
default-config = ''
${setNixInit}
${inits.initText}
'';
2024-10-29 13:15:12 +01:00
emacsEnv = pkgs.buildEnv {
name = "emacs-env";
paths = with pkgs; [
python3
lua
multimarkdown
git
emacs-lsp-booster
llvmPackages.clang-tools
llvmPackages.clang
llvmPackages.lldb
(hiPrio gcc)
gdb
nixd
jdt-language-server
omnisharp-roslyn
];
};
2023-11-15 00:07:16 +01:00
cfg = config.materus.profile.editor.emacs;
setNixInit = ''
2024-10-29 13:15:12 +01:00
(setenv "PATH" (concat (getenv "PATH") ":${emacsEnv}/bin"))
(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)
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)
'';
2024-10-29 13:15:12 +01:00
in
{
options.materus.profile.editor.emacs.enable =
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
config = lib.mkIf cfg.enable {
2023-11-14 23:25:05 +01:00
home.activation.emacsCompile = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
mkdir -p ${config.xdg.configHome}/emacs/var/backups
mkdir -p ${config.xdg.configHome}/emacs/var/recovery
mkdir -p ${config.xdg.configHome}/emacs/etc
run ${config.programs.emacs.finalPackage}/bin/emacs --batch \
2024-03-11 16:19:31 +01:00
--eval '(setq warning-minimum-log-level :error)' \
--eval '(byte-recompile-directory "${config.xdg.configHome}/emacs/etc/materus" 0 t)' \
2024-03-11 16:19:31 +01:00
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")'
2023-11-14 23:25:05 +01:00
'';
2023-11-15 00:07:16 +01:00
xdg.configFile = {
"emacs/early-init.el".text = inits.earlyInitText;
"emacs/init.el".text = default-config;
"emacs/etc/materus" =
{
source = configPath + "etc/materus";
recursive = true;
};
};
2023-11-15 00:07:16 +01:00
programs.emacs = {
enable = true;
2024-10-30 16:37:59 +01:00
package =
lib.mkDefault (pkgs.emacs29.override {
withSQLite3 = true;
withWebP = true;
withX = true;
withGTK3 = true;
withAlsaLib = true;
withGconf = true;
withImageMagick = true;
withXwidgets = true;
2024-10-30 16:37:59 +01:00
});
extraPackages = epkgs: (packages epkgs);
2023-10-25 15:34:43 +02:00
};
2023-10-08 11:42:08 +02:00
};
}