Big emacs re-write to use crafted-emacs
emacs/default.nix now links new init.el and modules directories (mine and crafted-emacs) to ~/.config/emacs/ emacs/default.nix installs emacs29-pgtk with packages as needed in module *-config.el definitions Add tree-sitter with required parsers Remove doom-emacs and places it was set
This commit is contained in:
parent
ad0780915c
commit
55ae93f633
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
*~
|
||||||
*.swp
|
*.swp
|
||||||
.python-version
|
.python-version
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
34
flake.lock
34
flake.lock
|
@ -166,6 +166,22 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"crafted-emacs": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1697837545,
|
||||||
|
"narHash": "sha256-Sucimd2VjeUZ3GZ7kC1W+ix9t30npaHuZgjdvhHuTCU=",
|
||||||
|
"owner": "SystemCrafters",
|
||||||
|
"repo": "crafted-emacs",
|
||||||
|
"rev": "bc6618a2950e354cc6b1bc24c63f3b2c6d71141b",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "SystemCrafters",
|
||||||
|
"repo": "crafted-emacs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"crane": {
|
"crane": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
|
@ -246,22 +262,6 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"doom-emacs": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1696638825,
|
|
||||||
"narHash": "sha256-vrdwIu6F11OOSaS5SfgT/jx0Kvu7KaigthVGBENKR5k=",
|
|
||||||
"owner": "doomemacs",
|
|
||||||
"repo": "doomemacs",
|
|
||||||
"rev": "986398504d09e585c7d1a8d73a6394024fe6f164",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "doomemacs",
|
|
||||||
"repo": "doomemacs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fenix": {
|
"fenix": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
@ -659,7 +659,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"anyrun": "anyrun",
|
"anyrun": "anyrun",
|
||||||
"doom-emacs": "doom-emacs",
|
"crafted-emacs": "crafted-emacs",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"stylix": "stylix",
|
"stylix": "stylix",
|
||||||
|
|
|
@ -21,10 +21,6 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Non-flake inputs
|
# Non-flake inputs
|
||||||
doom-emacs = {
|
|
||||||
url = "github:doomemacs/doomemacs";
|
|
||||||
flake = false;
|
|
||||||
};
|
|
||||||
crafted-emacs = {
|
crafted-emacs = {
|
||||||
url = "github:SystemCrafters/crafted-emacs";
|
url = "github:SystemCrafters/crafted-emacs";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
@ -72,7 +68,7 @@
|
||||||
inherit (inputs) anyrun watershot;
|
inherit (inputs) anyrun watershot;
|
||||||
};
|
};
|
||||||
extraSpecialArgs = specialArgs // {
|
extraSpecialArgs = specialArgs // {
|
||||||
inherit (inputs) doom-emacs crafted-emacs tokyonight-folke;
|
inherit (inputs) crafted-emacs tokyonight-folke;
|
||||||
};
|
};
|
||||||
in nixpkgs.lib.nixosSystem {
|
in nixpkgs.lib.nixosSystem {
|
||||||
inherit system specialArgs;
|
inherit system specialArgs;
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
;;; early-init.el --- Emacs early initialization for Crafted Emacs (optional) -*- lexical-binding: t; -*-
|
|
||||||
;;; Commentary:
|
|
||||||
;;
|
|
||||||
;;; Code:
|
|
||||||
|
|
||||||
;; Configures `package.el'
|
|
||||||
(load "~/Projects/crafted-emacs/modules/crafted-early-init-config")
|
|
||||||
(provide 'early-init)
|
|
||||||
|
|
||||||
;;; early-init.el ends here
|
|
|
@ -1,16 +1,13 @@
|
||||||
{ config, pkgs, doom-emacs, ... }:
|
{ config, pkgs, crafted-emacs, ... }:
|
||||||
let
|
|
||||||
sessionVariables = rec {
|
{
|
||||||
DOOMLOCALDIR = "${config.home.homeDirectory}/.local/share/doomemacs";
|
imports = [ ./formatters.nix ./lsp_servers.nix ./tree-sitter.nix ];
|
||||||
DOOMPROFILELOADFILE = "${DOOMLOCALDIR}/load.el";
|
stylix.targets.emacs.enable = false;
|
||||||
};
|
|
||||||
in {
|
|
||||||
imports = [ ./formatters.nix ./lsp_servers.nix ];
|
|
||||||
xdg.configFile = {
|
xdg.configFile = {
|
||||||
emacs.source = doom-emacs;
|
"emacs/init.el".source = ./init.el;
|
||||||
doom.source = ./doom;
|
"emacs/modules".source = ./modules;
|
||||||
|
"emacs/crafted-emacs".source = crafted-emacs;
|
||||||
};
|
};
|
||||||
systemd.user = { inherit sessionVariables; };
|
|
||||||
services.git-sync = {
|
services.git-sync = {
|
||||||
enable = true;
|
enable = true;
|
||||||
repositories.org = {
|
repositories.org = {
|
||||||
|
@ -20,18 +17,55 @@ in {
|
||||||
};
|
};
|
||||||
programs.emacs = {
|
programs.emacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.emacs29-pgtk;
|
package = with pkgs;
|
||||||
};
|
((emacsPackagesFor emacs29-pgtk).emacsWithPackages (epkgs:
|
||||||
stylix.targets.emacs.enable = false;
|
with epkgs; [
|
||||||
home = {
|
# Theme
|
||||||
inherit sessionVariables;
|
doom-themes
|
||||||
sessionPath = [ "${config.xdg.configHome}/emacs/bin" ];
|
|
||||||
packages = with pkgs; [
|
|
||||||
# Additional/Compiled Emacs packages
|
|
||||||
emacsPackages.mu4e
|
|
||||||
emacsPackages.vterm
|
|
||||||
emacsPackages.pdf-tools
|
|
||||||
|
|
||||||
|
# crafted-completion-packages
|
||||||
|
cape
|
||||||
|
consult
|
||||||
|
corfu
|
||||||
|
corfu-terminal
|
||||||
|
embark
|
||||||
|
embark-consult
|
||||||
|
marginalia
|
||||||
|
orderless
|
||||||
|
vertico
|
||||||
|
|
||||||
|
# crafted-ide-packages
|
||||||
|
treesit-auto
|
||||||
|
editorconfig
|
||||||
|
aggressive-indent
|
||||||
|
ibuffer-project
|
||||||
|
|
||||||
|
# crafted-org-packages
|
||||||
|
denote
|
||||||
|
org-appear
|
||||||
|
|
||||||
|
# crafted-ui-packages
|
||||||
|
all-the-icons
|
||||||
|
elisp-demos
|
||||||
|
helpful
|
||||||
|
|
||||||
|
# crafted-workspaces-packages
|
||||||
|
tabspaces
|
||||||
|
|
||||||
|
# crafted-writing-packages
|
||||||
|
markdown-mode
|
||||||
|
pandoc-mode
|
||||||
|
auctex
|
||||||
|
auctex-latexmk
|
||||||
|
|
||||||
|
# Additional packages
|
||||||
|
magit
|
||||||
|
vterm
|
||||||
|
nix-mode
|
||||||
|
]));
|
||||||
|
};
|
||||||
|
home = {
|
||||||
|
packages = with pkgs; [
|
||||||
# Emacs dependencies
|
# Emacs dependencies
|
||||||
coreutils
|
coreutils
|
||||||
gnutls
|
gnutls
|
||||||
|
@ -55,10 +89,6 @@ in {
|
||||||
rustup
|
rustup
|
||||||
texlive.combined.scheme-medium
|
texlive.combined.scheme-medium
|
||||||
python3
|
python3
|
||||||
python3Packages.cython
|
|
||||||
python3Packages.pyflakes
|
|
||||||
python3Packages.nose
|
|
||||||
python3Packages.pytest
|
|
||||||
nodePackages.stylelint
|
nodePackages.stylelint
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,22 +9,36 @@
|
||||||
;; This can be done here, or in the early-init.el file.
|
;; This can be done here, or in the early-init.el file.
|
||||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
||||||
(when (and custom-file (file-exists-p custom-file))
|
(when (and custom-file (file-exists-p custom-file))
|
||||||
(load custom-file nil :nomessage))
|
(load custom-file nil 'nomessage))
|
||||||
|
|
||||||
;; Adds crafted-emacs modules to the `load-path', sets up a module
|
;; Add custom modules to the `load-path'
|
||||||
;; writing template, sets the `crafted-emacs-home' variable.
|
(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
|
||||||
(load "~/Projects/crafted-emacs/modules/crafted-init-config")
|
|
||||||
|
;; Adds crafted-emacs modules to the `load-path'
|
||||||
|
(setq crafted-emacs-home (expand-file-name "crafted-emacs" user-emacs-directory))
|
||||||
|
(add-to-list 'load-path (expand-file-name "modules" crafted-emacs-home))
|
||||||
|
|
||||||
;;; Configuration phase
|
;;; Configuration phase
|
||||||
|
|
||||||
;; Some example modules to configure Emacs. Don't blindly copy these,
|
;; Some example modules to configure Emacs. Don't blindly copy these,
|
||||||
;; they are here for example purposes. Find the modules which work
|
;; they are here for example purposes. Find the modules which work
|
||||||
;; for you and add them here.
|
;; for you and add them here.
|
||||||
;; (require 'crafted-defaults-config)
|
(require 'crafted-completion-config)
|
||||||
;; (require 'crafted-startup-config)
|
(require 'crafted-defaults-config)
|
||||||
|
(require 'crafted-ide-config)
|
||||||
|
(require 'crafted-org-config)
|
||||||
|
(require 'crafted-startup-config)
|
||||||
|
(require 'crafted-ui-config)
|
||||||
|
(require 'crafted-workspaces-packages)
|
||||||
|
(require 'crafted-writing-packages)
|
||||||
|
|
||||||
;;; Optional configuration
|
;;; Optional configuration
|
||||||
|
|
||||||
|
;; Set theme to Tokyo Night from doom-themes
|
||||||
|
(load-theme 'doom-tokyo-night t)
|
||||||
|
(add-to-list 'default-frame-alist '(font . "FiraCode Nerd Font-12"))
|
||||||
|
(global-prettify-symbols-mode)
|
||||||
|
|
||||||
;; Profile emacs startup
|
;; Profile emacs startup
|
||||||
(defun crafted-startup-example/display-startup-time ()
|
(defun crafted-startup-example/display-startup-time ()
|
||||||
"Display the startup time after Emacs is fully initialized."
|
"Display the startup time after Emacs is fully initialized."
|
||||||
|
@ -34,4 +48,12 @@
|
||||||
|
|
||||||
;; Set default coding system (especially for Windows)
|
;; Set default coding system (especially for Windows)
|
||||||
(set-default-coding-systems 'utf-8)
|
(set-default-coding-systems 'utf-8)
|
||||||
|
(set-terminal-coding-system 'utf-8)
|
||||||
|
(set-keyboard-coding-system 'utf-8)
|
||||||
|
|
||||||
|
;; Set org directory
|
||||||
|
(setq org-directory "~/Org")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
nodePackages.pyright
|
nodePackages.pyright
|
||||||
nodePackages.yaml-language-server
|
nodePackages.yaml-language-server
|
||||||
nodePackages.bash-language-server
|
nodePackages.bash-language-server
|
||||||
|
nodePackages.javascript-typescript-langserver
|
||||||
nodePackages.vscode-html-languageserver-bin
|
nodePackages.vscode-html-languageserver-bin
|
||||||
nodePackages.vscode-css-languageserver-bin
|
nodePackages.vscode-css-languageserver-bin
|
||||||
nodePackages.vscode-json-languageserver-bin
|
nodePackages.vscode-json-languageserver-bin
|
||||||
|
|
58
home/emacs/modules/custom-ligatures-config.el
Normal file
58
home/emacs/modules/custom-ligatures-config.el
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
(defun fira-code-mode--make-alist (list)
|
||||||
|
"Generate prettify-symbols alist from LIST."
|
||||||
|
(let ((idx -1))
|
||||||
|
(mapcar
|
||||||
|
(lambda (s)
|
||||||
|
(setq idx (1+ idx))
|
||||||
|
(let* ((code (+ #Xe100 idx))
|
||||||
|
(width (string-width s))
|
||||||
|
(prefix ())
|
||||||
|
(suffix '(?\s (Br . Br)))
|
||||||
|
(n 1))
|
||||||
|
(while (< n width)
|
||||||
|
(setq prefix (append prefix '(?\s (Br . Bl))))
|
||||||
|
(setq n (1+ n)))
|
||||||
|
(cons s (append prefix suffix (list (decode-char 'ucs code))))))
|
||||||
|
list)))
|
||||||
|
|
||||||
|
(defconst fira-code-mode--ligatures
|
||||||
|
'("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\"
|
||||||
|
"{-" "[]" "::" ":::" ":=" "!!" "!=" "!==" "-}"
|
||||||
|
"--" "---" "-->" "->" "->>" "-<" "-<<" "-~"
|
||||||
|
"#{" "#[" "##" "###" "####" "#(" "#?" "#_" "#_("
|
||||||
|
".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*"
|
||||||
|
"/**" "/=" "/==" "/>" "//" "///" "&&" "||" "||="
|
||||||
|
"|=" "|>" "^=" "$>" "++" "+++" "+>" "=:=" "=="
|
||||||
|
"===" "==>" "=>" "=>>" "<=" "=<<" "=/=" ">-" ">="
|
||||||
|
">=>" ">>" ">>-" ">>=" ">>>" "<*" "<*>" "<|" "<|>"
|
||||||
|
"<$" "<$>" "<!--" "<-" "<--" "<->" "<+" "<+>" "<="
|
||||||
|
"<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<" "<~"
|
||||||
|
"<~~" "</" "</>" "~@" "~-" "~=" "~>" "~~" "~~>" "%%"
|
||||||
|
"x" ":" "+" "+" "*"))
|
||||||
|
|
||||||
|
(defvar fira-code-mode--old-prettify-alist)
|
||||||
|
|
||||||
|
(defun fira-code-mode--enable ()
|
||||||
|
"Enable Fira Code ligatures in current buffer."
|
||||||
|
(setq-local fira-code-mode--old-prettify-alist prettify-symbols-alist)
|
||||||
|
(setq-local prettify-symbols-alist (append (fira-code-mode--make-alist fira-code-mode--ligatures) fira-code-mode--old-prettify-alist))
|
||||||
|
(prettify-symbols-mode t))
|
||||||
|
|
||||||
|
(defun fira-code-mode--disable ()
|
||||||
|
"Disable Fira Code ligatures in current buffer."
|
||||||
|
(setq-local prettify-symbols-alist fira-code-mode--old-prettify-alist)
|
||||||
|
(prettify-symbols-mode -1))
|
||||||
|
|
||||||
|
(define-minor-mode fira-code-mode
|
||||||
|
"Fira Code ligatures minor mode"
|
||||||
|
:lighter " Fira Code"
|
||||||
|
(setq-local prettify-symbols-unprettify-at-point 'right-edge)
|
||||||
|
(if fira-code-mode
|
||||||
|
(fira-code-mode--enable)
|
||||||
|
(fira-code-mode--disable)))
|
||||||
|
|
||||||
|
(defun fira-code-mode--setup ()
|
||||||
|
"Setup Fira Code Symbols"
|
||||||
|
(set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol"))
|
||||||
|
|
||||||
|
(provide 'fira-code-mode)
|
38
home/emacs/tree-sitter.nix
Normal file
38
home/emacs/tree-sitter.nix
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
# Usage:
|
||||||
|
# pkgs.tree-sitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ])
|
||||||
|
#
|
||||||
|
# or for all grammars:
|
||||||
|
# pkgs.tree-sitter.withPlugins (_: allGrammars)
|
||||||
|
# which is equivalent to
|
||||||
|
# pkgs.tree-sitter.withPlugins (p: builtins.attrValues p)
|
||||||
|
{
|
||||||
|
home.packages = [
|
||||||
|
(pkgs.tree-sitter.withPlugins (p:
|
||||||
|
with p; [
|
||||||
|
tree-sitter-bash
|
||||||
|
tree-sitter-bibtex
|
||||||
|
tree-sitter-css
|
||||||
|
tree-sitter-dockerfile
|
||||||
|
tree-sitter-elisp
|
||||||
|
tree-sitter-fortran
|
||||||
|
tree-sitter-html
|
||||||
|
tree-sitter-javascript
|
||||||
|
tree-sitter-json
|
||||||
|
tree-sitter-latex
|
||||||
|
tree-sitter-llvm
|
||||||
|
tree-sitter-lua
|
||||||
|
tree-sitter-make
|
||||||
|
tree-sitter-markdown
|
||||||
|
tree-sitter-nix
|
||||||
|
tree-sitter-python
|
||||||
|
tree-sitter-regex
|
||||||
|
tree-sitter-rst
|
||||||
|
tree-sitter-rust
|
||||||
|
tree-sitter-scss
|
||||||
|
tree-sitter-toml
|
||||||
|
tree-sitter-typescript
|
||||||
|
tree-sitter-yaml
|
||||||
|
]))
|
||||||
|
];
|
||||||
|
}
|
|
@ -18,8 +18,6 @@ in ''
|
||||||
env = QT_QPA_PLATFORM,wayland
|
env = QT_QPA_PLATFORM,wayland
|
||||||
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
|
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
|
||||||
env = MOZ_ENABLE_WAYLAND,1
|
env = MOZ_ENABLE_WAYLAND,1
|
||||||
env = DOOMLOCALDIR=${config.home.sessionVariables.DOOMLOCALDIR};
|
|
||||||
env = DOOMPROFILELOADFILE=${config.home.sessionVariables.DOOMPROFILELOADFILE};
|
|
||||||
|
|
||||||
exec-once = hyprctl setcursor ${cursorName} ${cursorSize}
|
exec-once = hyprctl setcursor ${cursorName} ${cursorSize}
|
||||||
exec-once = dbus-update-activation-environment --systemd --all
|
exec-once = dbus-update-activation-environment --systemd --all
|
||||||
|
|
Loading…
Reference in a new issue