Add initial emacs configuration

This commit is contained in:
caem 2025-01-31 23:17:00 +01:00
parent 48d7657d7c
commit af755e7e07
Signed by: caem
GPG key ID: 69A830D03203405F
10 changed files with 88 additions and 5 deletions

View file

@ -11,6 +11,7 @@
"${modules}/multimedia"
"${modules}/desktop/gnome"
"${modules}/communication"
"${modules}/development"
];
}

View file

@ -1,6 +1,7 @@
{ pkgs, ... }:
{ pkgs, config, ... }:
let
# Has to be >= 29 due to treesitter
emacsPkg = "emacs30";
in {
services.emacs = {
@ -11,6 +12,10 @@ in {
programs.emacs = {
enable = true;
package = pkgs."${emacsPkg}-pgtk";
package = (pkgs."${emacsPkg}-pgtk".pkgs.withPackages (epkgs: [
epkgs.treesit-grammars.with-all-grammars
]));
};
home.file."${config.xdg.configHome}/emacs".source = ./emacs.d;
}

View file

@ -0,0 +1,8 @@
(setq custom-file "/dev/null")
(let ((backup_dir (concat (or (getenv "XDG_CACHE_HOME") "~/.cache") "/emacs_backups")))
(make-directory backup_dir t)
(setq backup-directory-alist '(("." . backup_dir))
backup-by-copying t))
(setq inhibit-startup-message t)

View file

@ -0,0 +1,20 @@
(tool-bar-mode 0)
(menu-bar-mode 0)
(scroll-bar-mode 0)
(setq display-line-numbers-type 'relative)
(global-display-line-numbers-mode t)
(global-hl-line-mode t)
(set-frame-parameter nil 'alpha-background 90)
(add-to-list 'default-frame-alist
'(font . "Go Mono Nerd Font-12"))
;; Temporary theme. Replace later.
(use-package doom-themes
:ensure t
:config
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
(doom-themes-org-config)
(load-theme 'doom-sourcerer t))

View file

@ -0,0 +1,8 @@
(ido-mode 1)
(ido-everywhere 1)
(use-package smex
:ensure t
:bind (("M-x" . smex)
("M-X" . smex-major-mode-commands))
:config (smex-initialize))

View file

@ -0,0 +1,27 @@
;; Set up paths so that emacs never touches ~/.config/emacs
(let ((data-home (concat (or (getenv "XDG_DATA_HOME") "~/.local/share") "/emacs")))
(setq user-emacs-directory data-home
custom-file (expand-file-name "custom.el" data-home)
url-history-file (expand-file-name "url/history" data-home)
package-user-dir (expand-file-name "elpa" data-home)
boomark-default-file (expand-file-name "bookmarks" data-home)
recentf-save-file (expand-file-name "recentf" data-home)
tramp-persistent-file-name (expand-file-name "tramp" data-home)
auto-save-list-file-prefix (expand-file-name "auto-save-list/.saves-" data-home)
abbrev-file-name (expand-file-name "abbrev.el" data-home)
savehist-file (expand-file-name "savehist" data-home)
server-auth-dir (expand-file-name "server" data-home)
package-quickstart-file (expand-file-name "package-quickstart.elc" data-home)))
(setq conf-home (concat (or (getenv "XDG_CONFIG_HOME") "~/.config") "/emacs"))
(package-initialize)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(load (expand-file-name "./appearance.el" conf-home))
(load (expand-file-name "./annoyances.el" conf-home))
(load (expand-file-name "./completions.el" conf-home))
(load (expand-file-name "./languages.el" conf-home))

View file

@ -0,0 +1 @@
(mapc 'load (file-expand-wildcards (expand-file-name "./languages/*.el" conf-home)))

View file

@ -0,0 +1,7 @@
(use-package nix-mode
:ensure t
:mode "\\.nix\\'")
(use-package pretty-sha-path
:ensure t
:config (global-pretty-sha-path-mode 1))

View file

@ -0,0 +1,9 @@
{ username, ... }:
{
environment.persistence."/nix/persist" = {
users."${username}".directories = [
".local/share/emacs"
];
};
}

View file

@ -15,9 +15,6 @@
"images"
"videos"
"programming"
# Temporary persist until I get a proper emacs configuration
".emacs.d"
];
};
};