editors: move helix and emacs

This commit is contained in:
Charlie Root 2024-09-01 21:37:24 +02:00
commit f54936fef7
3 changed files with 221 additions and 1 deletions

View file

@ -1 +1,8 @@
_: {imports = [./emacs.nix ./helix.nix ./kakoune ./nvf];}
_: {
imports = [
./emacs/module.nix
./helix/module.nix
./kakoune
./nvf
];
}

View file

@ -0,0 +1,139 @@
{
config,
lib,
pkgs,
inputs,
...
}: let
cfg = config.modules.system.programs.editors.emacs;
inherit (config.modules.other.system) username;
inherit (lib) mkIf;
# Taken from outfoxxed since figuring this out is really annoying.
pkgswithemacs =
pkgs.appendOverlays
(with inputs.emacs-overlay.overlays; [
emacs
package
]);
custom-emacs = with pkgswithemacs; ((emacsPackagesFor
(emacs29-pgtk.override {withNativeCompilation = true;}))
.emacsWithPackages (epkgs:
with epkgs; [
# alert
# all-the-icons
# all-the-icons-dired
# avy
# beacon
# catppuccin-theme
# cask-mode
# company
# crux
# dimmer
# dired-du
# dired-open
# direnv
# dirvish
# doom-modeline
# editorconfig
# emacs-all-the-icons-fonts
# evil
# evil-collection
# evil-commentary
# evil-goggles
# flycheck
# flycheck-relint
# flymake
# form-feed
# general
# hl-todo
# ligature
# lsp-mode
# lsp-treemacs
# lsp-ui
# macrostep
# magit
# markdown-mode
# modus-themes
# move-text
# org-cliplink
org-contacts
# org-pomodoro
# nano-theme
# no-littering
# nov
# paredit
# peep-dired
# projectile
# rainbow-delimiters
# rainbow-mode
# relint
# ripgrep
# smartparens
# string-inflection
# svg-lib
# tldr
# toc-org
# treesit-grammars.with-all-grammars
# treemacs
# treemacs-evil
# treemacs-projectile
# treemacs-magit
# tree-sitter
# undo-tree
# use-package
# vertico
# vertico-posframe
vterm
# vterm-toggle
# which-key
# whitespace-cleanup-mode
# wakatime-mode
# ws-butler
]));
in {
config = mkIf cfg.enable {
environment.variables.PATH = ["$XDG_CONFIG_HOME/emacs/bin"];
home-manager.users.${username} = {
home.packages = with pkgs; [
# needed my native-comp
binutils
# Emacs itself
custom-emacs
# Doom dependencies
git
ripgrep
gnutls
## Optional dependencies
fd # faster projectile indexing
imagemagick # for image-dired
# (mkIf (config.programs.gnupg.agent.enable)
# pinentry-emacs) # in-emacs gnupg prompts
zstd # for undo-fu-session/undo-tree compression
# Module dependencies
# :checkers spell
(aspellWithDicts (ds: with ds; [de en en-computers en-science]))
# :tools editorconfig
editorconfig-core-c # per-project style config
# :tools lookup & :lang org +roam
sqlite
# :lang latex & :lang org (latex previews)
# texlive.combined.scheme-medium
# :lang beancount
# beancount
# fava
# :lang nix
age
];
services.emacs = {
enable = true;
package = custom-emacs;
};
};
};
}

View file

@ -0,0 +1,74 @@
{
config,
inputs',
lib,
pkgs,
...
}: let
cfg = config.modules.system.programs.editors.helix;
inherit (config.modules.other.system) username;
inherit (lib) mkIf getExe makeBinPath;
in {
config = mkIf cfg.enable {
home-manager.users.${username} = {
programs.helix = {
enable = true;
# thanks fufexan, this is great!
package = inputs'.helix.packages.default.helix.overrideAttrs (previousAttrs: {
makeWrapperArgs = with pkgs;
previousAttrs.makeWrapperArgs
or []
++ [
"--suffix"
"PATH"
":"
(makeBinPath [
clang-tools
marksman
nil
bash-language-server
shellcheck
])
];
});
settings = {
theme = "catppuccin_mocha";
editor = {
cursorline = true;
color-modes = true;
indent-guides.render = true;
lsp.display-inlay-hints = true;
line-number = "relative";
true-color = true;
mouse = true;
bufferline = "multiple";
soft-wrap.enable = true;
lsp.display-messages = true;
cursor-shape = {insert = "bar";};
statusline.left = ["mode" "spinner" "version-control" "file-name"];
inline-diagnostics = {
cursor-line = "hint";
other-lines = "error";
};
};
keys.normal = {
C-g = [":new" ":insert-output lazygit" ":buffer-close!" ":redraw"];
esc = ["collapse_selection" "keep_primary_selection"];
A-H = "goto_previous_buffer";
A-L = "goto_next_buffer";
A-w = ":buffer-close";
A-f = ":format";
};
};
languages = {
language-server = {
nil = {
command = getExe pkgs.nil;
config.nil.formatting.command = ["${getExe pkgs.alejandra}" "-q"];
};
};
};
};
};
};
}