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

123 lines
3.1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, materusArg, ... }:
2023-10-08 11:42:08 +02:00
let
2023-11-15 00:07:16 +01:00
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
inits = import ./init.nix {path = configPath; inherit pkgs;};
packages = epkgs: with epkgs; [
load-relative
2023-11-08 10:46:45 +01:00
elcord
persp-mode
2023-11-04 10:50:50 +01:00
dashboard
2023-10-25 19:28:25 +02:00
magit
2023-10-25 15:34:43 +02:00
helm
avy
corfu
vterm
centaur-tabs
2023-11-08 10:46:45 +01:00
projectile
company
clipetty
2023-11-08 10:46:45 +01:00
2023-10-25 15:34:43 +02:00
treemacs
2023-10-25 19:28:25 +02:00
treemacs-nerd-icons
2023-11-08 10:46:45 +01:00
treemacs-perspective
treemacs-icons-dired
treemacs-magit
treemacs-projectile
2023-10-25 19:28:25 +02:00
tree-edit
2023-11-08 10:46:45 +01:00
vertico
2023-10-25 19:28:25 +02:00
nerd-icons
nerd-icons-completion
2023-11-08 10:46:45 +01:00
perspective
minions
telephone-line
rainbow-delimiters
use-package
2023-10-25 15:34:43 +02:00
2023-11-14 23:25:05 +01:00
cmake-mode
2023-10-25 15:34:43 +02:00
lsp-mode
2023-11-14 23:25:05 +01:00
lsp-java
lsp-jedi
lsp-haskell
lsp-ui
lsp-treemacs
dap-mode
2023-10-25 15:34:43 +02:00
d-mode
multiple-cursors
2023-10-25 15:34:43 +02:00
org
org-rainbow-tags
2023-11-14 23:25:05 +01:00
org-roam
org-roam-ui
org-review
2023-10-25 15:34:43 +02:00
markdown-mode
json-mode
2023-11-08 10:46:45 +01:00
nix-mode
minimap
2023-11-14 23:25:05 +01:00
2023-11-05 11:59:54 +01:00
moe-theme
2023-11-14 23:25:05 +01:00
doom-themes
2023-10-25 15:34:43 +02:00
];
default-config = ''
(defvar materus/nix-packages t)
(defvar materus/init-from-home nil)
2023-11-15 00:07:16 +01:00
(unless materus/init-from-home
(message "Config loading not from homeDir, need \"materus/init-from-home\" variable in init.el")
${setNixInit}
2023-11-15 00:07:16 +01:00
${inits.initText}
)
'';
emacsPkgs = with pkgs;[
python3
lua
multimarkdown
git
];
2023-11-15 00:07:16 +01:00
cfg = config.materus.profile.editor.emacs;
setNixInit = ''
(setenv "PATH" (concat (getenv "PATH") ":${lib.makeBinPath emacsPkgs}"))
${builtins.concatStringsSep "\n" (builtins.map (x: "(setq exec-path (append exec-path '(\""+x+"/bin\")))" ) emacsPkgs)}
(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";
config = lib.mkIf cfg.enable {
2023-11-14 23:25:05 +01:00
home.activation.emacsCompile = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
${config.programs.emacs.finalPackage}/bin/emacs --batch \
--eval '(setq warning-minimum-log-level :error)' \
2023-11-15 00:07:16 +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
'';
xdg.configFile."emacs/init.el".text = ''
(defvar materus/nix-packages nil)
(defvar materus/init-from-home t)
(setq-default materus/init-from-home t)
2023-11-15 00:07:16 +01:00
${setNixInit}
${inits.initText}
'';
2023-11-15 00:07:16 +01:00
xdg.configFile."emacs/early-init.el".text = ''
${inits.earlyInitText}
'';
programs.emacs = {
enable = true;
package = with pkgs; lib.mkDefault (emacs29.override { withX = true; withGTK3 = true; withAlsaLib = true; withGconf = true; withImageMagick = true; withXwidgets = true; });
2023-11-15 00:07:16 +01:00
extraPackages = epkgs: ((packages epkgs));
extraConfig = default-config;
2023-10-25 15:34:43 +02:00
};
2023-10-08 11:42:08 +02:00
};
}