From f54936fef7feeee1def3fc9693c1d164b97dd284 Mon Sep 17 00:00:00 2001 From: Charlie Root Date: Sun, 1 Sep 2024 21:37:24 +0200 Subject: [PATCH] editors: move helix and emacs --- modules/programs/editors/default.nix | 9 +- modules/programs/editors/emacs/module.nix | 139 ++++++++++++++++++++++ modules/programs/editors/helix/module.nix | 74 ++++++++++++ 3 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 modules/programs/editors/emacs/module.nix create mode 100644 modules/programs/editors/helix/module.nix diff --git a/modules/programs/editors/default.nix b/modules/programs/editors/default.nix index 49ace18..2d8e694 100644 --- a/modules/programs/editors/default.nix +++ b/modules/programs/editors/default.nix @@ -1 +1,8 @@ -_: {imports = [./emacs.nix ./helix.nix ./kakoune ./nvf];} +_: { + imports = [ + ./emacs/module.nix + ./helix/module.nix + ./kakoune + ./nvf + ]; +} diff --git a/modules/programs/editors/emacs/module.nix b/modules/programs/editors/emacs/module.nix new file mode 100644 index 0000000..e52a214 --- /dev/null +++ b/modules/programs/editors/emacs/module.nix @@ -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; + }; + }; + }; +} diff --git a/modules/programs/editors/helix/module.nix b/modules/programs/editors/helix/module.nix new file mode 100644 index 0000000..0001c54 --- /dev/null +++ b/modules/programs/editors/helix/module.nix @@ -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"]; + }; + }; + }; + }; + }; + }; +}