Lot of changes, ignoring previous commits format

This commit is contained in:
2024-11-15 18:01:13 +01:00
parent 3d1cc80150
commit 9e97dc6f65
20 changed files with 1288 additions and 746 deletions
@@ -111,6 +111,11 @@ let
"[cpp]" = {
"editor.defaultFormatter" = lib.mkDefault "xaver.clang-format";
};
"cmake.showOptionsMovedNotification" = false;
"cmake.pinnedCommands" = [
"workbench.action.tasks.configureTaskRunner"
"workbench.action.tasks.runTask"
];
};
in {
@@ -17,24 +17,120 @@ let
};
configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/";
inits = import ./init.nix {
path = configPath;
inherit pkgs;
};
packages = epkgs:
with epkgs; [
(materus-config epkgs)
treesit-grammars.with-all-grammars
];
default-config = ''
${setNixInit}
${inits.initText}
'';
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
];
emacsEnv = pkgs.buildEnv {
name = "emacs-env";
paths = with pkgs; [
ripgrep
cmake
gnumake
nixfmt-classic
python3
lua
@@ -48,6 +144,8 @@ let
gdb
nixd
jdt-language-server
jdk
gradle
omnisharp-roslyn
];
};
@@ -56,6 +154,7 @@ let
setNixInit = ''
(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)
@@ -65,26 +164,28 @@ in {
materusArg.pkgs.lib.mkBoolOpt false "Enable emacs with materus cfg";
config = lib.mkIf cfg.enable {
home.activation.emacsCompile = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
home.activation.emacsSetup = lib.hm.dag.entryAfter [ "linkGeneration" ] ''
mkdir -p ${config.xdg.configHome}/emacs/var/recovery
mkdir -p ${config.xdg.configHome}/emacs/etc
mkdir -p ${config.xdg.configHome}/emacs/etc/materus
mkdir -p ${config.xdg.configHome}/emacs/var/backups
run ${config.programs.emacs.finalPackage}/bin/emacs --batch \
--eval '(setq warning-minimum-log-level :error)' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/early-init.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/etc/materus/emacs-config.el")' \
--eval '(byte-compile-file "${config.xdg.configHome}/emacs/init.el")'
${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")'
'';
xdg.configFile = {
"emacs/early-init.el".text = inits.earlyInitText;
"emacs/init.el".text = default-config;
"emacs/etc/materus" = {
source = configPath + "etc/materus";
recursive = true;
};
};
xdg.configFile = { "emacs/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";
@@ -128,18 +229,31 @@ in {
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);
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;}));
})));
};
};
@@ -1,13 +0,0 @@
{ path, pkgs }:
{
earlyInitText = ''
${builtins.readFile (path + "early-init.el")}
'';
initText = ''
${builtins.readFile (path + "init.el")}
'';
}
@@ -9,11 +9,17 @@ in
config = lib.mkIf cfg.enable {
programs.bash = {
enable = true;
enableCompletion = lib.mkDefault true;
enableVteIntegration = lib.mkDefault true;
historyControl = lib.mkDefault [ "erasedups" "ignorespace" ];
shellOptions = lib.mkDefault [ "autocd" "checkwinsize" "cmdhist" "expand_aliases" "extglob" "globstar" "checkjobs" "nocaseglob" ];
initExtra = ''
if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
source "$EAT_SHELL_INTEGRATION_DIR/bash";
fi
'';
};
};
@@ -85,6 +85,11 @@ in
${makeEnv "__MATERUS_HM_ZSH_PRIVATE" "0"}
'';
initExtraFirst = ''
if [ -n "$EAT_SHELL_INTEGRATION_DIR" ]; then
source "$EAT_SHELL_INTEGRATION_DIR/zsh";
fi
${makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''
if [[ -r "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh" ]]; then
source "''${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-''${(%):-%n}.zsh"
@@ -166,6 +171,8 @@ in
${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "e"="emacsclient -nw -c --alternate-editor= "''}
${lib.optionalString config.materus.profile.editor.emacs.enable ''alias "ee"="emacsclient -n -r --alternate-editor= "''}
'' +
makeIfVar "__MATERUS_HM_ZSH_PROMPT" "p10k" ''