From 1154c452911b2910707c516f3a3764544474e260 Mon Sep 17 00:00:00 2001 From: materus Date: Mon, 28 Oct 2024 16:31:39 +0100 Subject: [PATCH] materusPC: plasma-manager and emacs updates --- .../host/materusPC/home/materus/default.nix | 2 +- .../host/materusPC/home/materus/plasma.nix | 1 + .../host/materusPC/other/desktop/kde.nix | 1 + .../profile/home/editor/emacs/default.nix | 181 +++++++++--------- .../profile/home/editor/emacs/init.nix | 9 +- extraFiles/config/emacs/early-init.el | 7 + extraFiles/config/emacs/init.el | 38 +++- extraFiles/config/emacs/packages.el | 33 ---- 8 files changed, 131 insertions(+), 141 deletions(-) delete mode 100644 extraFiles/config/emacs/packages.el diff --git a/configurations/host/materusPC/home/materus/default.nix b/configurations/host/materusPC/home/materus/default.nix index 41deb94..78f9ca1 100644 --- a/configurations/host/materusPC/home/materus/default.nix +++ b/configurations/host/materusPC/home/materus/default.nix @@ -17,7 +17,7 @@ enableTerminal = lib.mkDefault true; enableTerminalExtra = lib.mkDefault true; enableNixDevel = lib.mkDefault true; - editor.emacs.enable = false; + editor.emacs.enable = true; editor.code.fhs.enable = true; editor.code.fhs.packages = (ps: with ps; let llvmpkgs = llvmPackages_18; in [ llvmpkgs.clang diff --git a/configurations/host/materusPC/home/materus/plasma.nix b/configurations/host/materusPC/home/materus/plasma.nix index 1a3b465..caf3778 100644 --- a/configurations/host/materusPC/home/materus/plasma.nix +++ b/configurations/host/materusPC/home/materus/plasma.nix @@ -44,6 +44,7 @@ shortcuts = { "kwin"."Grid View" = "Meta+Alt+Tab"; "kwin"."Overview" = "Meta+Tab"; + "services/org.kde.kcalc.desktop"."_launch" = [ ]; }; spectacle.shortcuts = { captureActiveWindow = "Meta+Print"; diff --git a/configurations/host/materusPC/other/desktop/kde.nix b/configurations/host/materusPC/other/desktop/kde.nix index 248177a..28cb618 100644 --- a/configurations/host/materusPC/other/desktop/kde.nix +++ b/configurations/host/materusPC/other/desktop/kde.nix @@ -26,6 +26,7 @@ }; environment.systemPackages = with pkgs; [ kdePackages.ark + kdePackages.kcalc ]; programs.kdeconnect.enable = true; materus.profile.steam.extraPkgs = [ pkgs.kdePackages.breeze pkgs.kdePackages.breeze-gtk pkgs.kdePackages.dolphin pkgs.vlc pkgs.vkbasalt-cli ]; diff --git a/configurations/profile/home/editor/emacs/default.nix b/configurations/profile/home/editor/emacs/default.nix index 2042f6c..901f25c 100644 --- a/configurations/profile/home/editor/emacs/default.nix +++ b/configurations/profile/home/editor/emacs/default.nix @@ -2,127 +2,122 @@ let configPath = "${materusArg.cfg.path}" + "/extraFiles/config/emacs/"; - inits = import ./init.nix { path = configPath; inherit pkgs; }; - packages = epkgs: with epkgs; [ - load-relative - elcord - persp-mode - dashboard - magit - helm - avy - corfu - vterm - centaur-tabs - projectile - company - clipetty + inits = import ./init.nix { + path = configPath; + inherit pkgs; + }; + packages = epkgs: + with epkgs; [ + load-relative + elcord + persp-mode + dashboard + magit + helm + avy + corfu + vterm + centaur-tabs + projectile + company + clipetty - treemacs - treemacs-nerd-icons - treemacs-perspective - treemacs-icons-dired - treemacs-magit - treemacs-projectile - tree-edit - vertico - nerd-icons - nerd-icons-completion - perspective - minions - telephone-line - rainbow-delimiters - use-package + treemacs + treemacs-nerd-icons + treemacs-perspective + treemacs-icons-dired + treemacs-magit + treemacs-projectile + tree-edit + vertico + 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 - multiple-cursors - org - org-rainbow-tags - org-roam - org-roam-ui - org-review - markdown-mode - json-mode - nix-mode - - minimap - - - moe-theme - doom-themes - ]; + cmake-mode + lsp-mode + lsp-java + lsp-jedi + lsp-haskell + lsp-ui + lsp-treemacs + dap-mode + d-mode + multiple-cursors + org + org-rainbow-tags + org-roam + org-roam-ui + org-review + markdown-mode + json-mode + nix-mode + no-littering + moe-theme + doom-themes + ]; default-config = '' - (defvar materus/nix-packages t) - (defvar materus/init-from-home nil) - (unless materus/init-from-home - (message "Config loading not from homeDir, need \"materus/init-from-home\" variable in init.el") - ${setNixInit} - ${inits.initText} - ) + ${setNixInit} + ${inits.initText} ''; - emacsPkgs = with pkgs;[ - python3 - lua - multimarkdown - git - ]; - + emacsPkgs = with pkgs; [ python3 lua multimarkdown git ]; 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) + ${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 148 = 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.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 \ --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/init.el")' ''; - xdg.configFile."emacs/init.el".text = '' - (defvar materus/nix-packages nil) - (defvar materus/init-from-home t) - (setq-default materus/init-from-home t) - - ${setNixInit} - ${inits.initText} - ''; xdg.configFile."emacs/early-init.el".text = '' ${inits.earlyInitText} ''; + xdg.configFile."emacs/init.el".text ='' + (require 'recentf) + (require 'no-littering) + (add-to-list 'recentf-exclude + (recentf-expand-file-name no-littering-var-directory)) + (add-to-list 'recentf-exclude + (recentf-expand-file-name no-littering-etc-directory)) + ''; programs.emacs = { enable = true; - package = with pkgs; lib.mkDefault (pkgs.emacs29.override { - withSQLite3 = true; - withWebP = true; - withX = true; - withGTK3 = true; - withAlsaLib = true; - withGconf = true; - withImageMagick = true; - withXwidgets = true; - }); + package = with pkgs; + lib.mkDefault (pkgs.emacs29.override { + withSQLite3 = true; + withWebP = true; + withX = true; + withGTK3 = true; + withAlsaLib = true; + withGconf = true; + withImageMagick = true; + withXwidgets = true; + }); extraPackages = epkgs: ((packages epkgs)); extraConfig = default-config; }; diff --git a/configurations/profile/home/editor/emacs/init.nix b/configurations/profile/home/editor/emacs/init.nix index 544f9b5..57393e2 100644 --- a/configurations/profile/home/editor/emacs/init.nix +++ b/configurations/profile/home/editor/emacs/init.nix @@ -5,13 +5,8 @@ ${builtins.readFile (path + "early-init.el")} ''; initText = '' - (defvar materus/init-from-home nil) - (when materus/init-from-home - (setq-default inhibit-defaul-init 1) - ) - (setq-default materus/nix-packages (require 'doom-themes nil 'noerror)) - ${builtins.readFile (path + "packages.el")} - ${builtins.readFile (path + "init.el")} + (require 'doom-themes nil 'noerror) + ${builtins.readFile (path + "init.el")} ''; } diff --git a/extraFiles/config/emacs/early-init.el b/extraFiles/config/emacs/early-init.el index 7dfb587..53cb0b8 100644 --- a/extraFiles/config/emacs/early-init.el +++ b/extraFiles/config/emacs/early-init.el @@ -26,3 +26,10 @@ ) ) ) + +(when (and (fboundp 'startup-redirect-eln-cache) + (fboundp 'native-comp-available-p) + (native-comp-available-p)) + (startup-redirect-eln-cache + (convert-standard-filename + (expand-file-name "var/eln-cache/" user-emacs-directory)))) diff --git a/extraFiles/config/emacs/init.el b/extraFiles/config/emacs/init.el index e8f6e40..f18cd20 100644 --- a/extraFiles/config/emacs/init.el +++ b/extraFiles/config/emacs/init.el @@ -26,16 +26,30 @@ ) ) ) -(setq auto-save-list-file-prefix (concat user-emacs-directory "backups/")) -(setq backup-directory-alist - `(("." . ,(concat user-emacs-directory "backups/")))) + + +(setq custom-file (concat user-emacs-directory "etc/custom.el")) + +(setq auto-save-default nil) +(setq backup-directory-alist + `((".*" . ,(concat user-emacs-directory "var/backups/")))) +(setq auto-save-file-name-transforms + `((".*" ,(concat user-emacs-directory "var/recovery/") t))) + + +; Load packages (require 'telephone-line) (require 'elcord) (require 'dashboard) (require 'minions) (require 'doom-themes) - +(require 'nerd-icons) +(require 'centaur-tabs) +(require 'projectile) +(require 'treemacs) +(require 'treemacs-projectile) +(require 'treemacs-nerd-icons) ;Graphical (setq frame-resize-pixelwise t) @@ -46,7 +60,6 @@ (setq read-process-output-max (* 1024 1024 3)) -(setq custom-file (concat user-emacs-directory "custom.el")) (when (or (not (display-graphic-p)) (daemonp)) (xterm-mouse-mode 1) ) @@ -79,18 +92,29 @@ ;Enable dashboard (setq dashboard-center-content t) +(setq dashboard-display-icons-p t) +(setq dashboard-icon-type 'nerd-icons) (dashboard-setup-startup-hook) (when (daemonp) (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))) ; Show dashboard when emacs is running as daemon ) +;Enable Centaur tabs +(centaur-tabs-mode t) +(setq centaur-tabs-set-bar 'over) +(setq centaur-tabs-set-modified-marker t) +;(setq centaur-tabs-modified-marker "*") - +;Enable treemacs +(global-set-key (kbd "C-H-t") 'treemacs) ;CUA (cua-mode 1) (global-set-key (kbd "C-y") 'undo-redo) -;(define-key key-translation-map [8711] 'event-apply-hyper-modifier ) + +(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier ) +(define-key key-translation-map (kbd "") 'event-apply-hyper-modifier ) + ;(global-set-key (kbd "C-∇") (kbd "C-H")) ;(global-set-key (kbd "H-∇") (lambda () (interactive) (insert-char #x2207))) diff --git a/extraFiles/config/emacs/packages.el b/extraFiles/config/emacs/packages.el deleted file mode 100644 index 6d7a806..0000000 --- a/extraFiles/config/emacs/packages.el +++ /dev/null @@ -1,33 +0,0 @@ - (defvar materus/nix-packages nil) - - - - (when (not materus/nix-packages) - (message "Not using config from nix packages, using straight") - (defvar bootstrap-version) - (let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 6)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) - (declare-function straight-use-package "straight" (&optional ARG)) - (straight-use-package 'load-relative) - - (straight-use-package 'use-package) - (straight-use-package 'telephone-line) - (straight-use-package 'elcord) - (straight-use-package 'dashboard) - (straight-use-package 'minions) - (straight-use-package 'lsp-mode) - (straight-use-package 'lsp-ui) - - (straight-use-package 'moe-theme) - (straight-use-package 'doom-themes) - ) -