Refactor the whole configuration

Reviewed-on: #1
This commit is contained in:
caem 2025-02-01 14:05:15 +01:00
parent fb5d4d46f8
commit 6cb66d86d2
153 changed files with 2078 additions and 3094 deletions

View file

@ -0,0 +1,5 @@
{ lib, ... }:
{
imports = lib.getModuleImports ./.;
}

View file

@ -0,0 +1,21 @@
{ pkgs, config, ... }:
let
# Has to be >= 29 due to treesitter
emacsPkg = "emacs30";
in {
services.emacs = {
enable = true;
package = pkgs."${emacsPkg}";
defaultEditor = true;
};
programs.emacs = {
enable = true;
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,9 @@
(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)
(setq auto-save-default nil)

View file

@ -0,0 +1,18 @@
(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 darktooth-theme
:ensure t
:config
(load-theme 'darktooth-dark t)
(set-face-background 'hl-line "#262626")) ;; darktooth-background-0

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,15 @@
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq indent-line-function 'insert-tab)
(setq-default show-trailing-whitespace t)
(use-package indent-bars
:ensure t
:hook (prog-mode . indent-bars-mode)
:custom
(indent-bars-display-on-blank-lines t)
(indent-bars-pattern " . . . ")
(indent-bars-color '("#7C6F64" :blend 0.2))
(indent-bars-width-frac 0.15)
(indent-bars-color-by-depth nil)
(indent-bars-highlight-current-depth '(:color "#DD6F48" :pattern "." :blend 0.4)))

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 "./formatting.el" conf-home))
(mapc 'load (file-expand-wildcards (expand-file-name "./languages/*.el" conf-home)))

View file

@ -0,0 +1,11 @@
(use-package nix-mode
:ensure t
:mode "\\.nix\\'")
(use-package pretty-sha-path
:ensure t
:config (global-pretty-sha-path-mode 1))
(add-hook 'nix-mode-hook
(lambda ()
(setq tab-width 2)))

View file

@ -0,0 +1,19 @@
{ ... }:
{
programs.ghostty = {
enable = true;
enableZshIntegration = true;
settings = let
literally_a_billion_million = 10000000000000;
in {
font-family = "Go Mono Nerd Font";
font-size = 12;
background-opacity = 0.85;
scrollback-limit = literally_a_billion_million;
theme = "Tomorrow Night Burns";
window-padding-x = 4;
window-padding-y = 4;
};
};
}

View file

@ -0,0 +1,17 @@
{ ... }:
{
programs.git = {
enable = true;
userName = "caem";
userEmail = "me@caem.dev";
signing = {
signByDefault = true;
key = "E50FC66B5062070DC462661C69A830D03203405F";
};
extraConfig = {
pull.rebase = true;
init.defaultBranch = "master";
};
};
}