diff options
Diffstat (limited to 'modules/emacs/default.nix')
-rw-r--r-- | modules/emacs/default.nix | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/modules/emacs/default.nix b/modules/emacs/default.nix new file mode 100644 index 0000000..ceba97e --- /dev/null +++ b/modules/emacs/default.nix @@ -0,0 +1,57 @@ +{ pkgs, inputs, lib, config, ...}: +let + outside-emacs = with pkgs; [ + (python3.withPackages (p: (with p; [ + python-lsp-server + python-lsp-ruff + ]))) + nil + ripgrep + emacs-lsp-booster + ]; + org-tangle-elisp-blocks = (pkgs.callPackage ./org.nix {inherit pkgs; inherit (inputs) from-elisp;}).org-tangle ({ language, flags } : + let is-elisp = (language == "emacs-lisp") || (language == "elisp"); + is-tangle = if flags ? ":tangle" then + flags.":tangle" == "yes" || flags.":tangle" == "y" else false; + in is-elisp && is-tangle + ); + config-el = pkgs.writeText "config.el" (org-tangle-elisp-blocks (builtins.readFile ./README.org)); + emacs = pkgs.emacsWithPackagesFromUsePackage { + package = pkgs.emacs.override { + withGTK3 = true; + withNativeCompilation = true; + withAlsaLib = true; + withSystemd = true; + withToolkitScrollBars = true; + }; + override = epkgs: epkgs // { + eglot-booster = pkgs.callPackage ./eglot-booster.nix { + inherit (pkgs) fetchFromGitHub; + inherit (epkgs) trivialBuild; + }; + }; + config = config-el; + alwaysEnsure = true; + defaultInitFile = true; + extraEmacsPackages = epkgs: with epkgs; [ + (treesit-grammars.with-grammars (g: with g; [ + tree-sitter-rust + tree-sitter-python + ])) + ] ++ outside-emacs; + }; +in with lib; { + options.santi-modules.emacs.enable = mkEnableOption "Enable emacs configuration"; + config = mkIf config.santi-modules.emacs.enable { + nixpkgs.overlays = [ inputs.emacs-overlay.overlays.default ]; + environment.systemPackages = [ + emacs + (pkgs.aspellWithDicts (dicts: with dicts; [ pt_BR en en-computers ])) + ] ++ outside-emacs; + fonts.packages = with pkgs; [ + emacs-all-the-icons-fonts + (nerdfonts.override { fonts = ["Iosevka"]; }) + ]; + }; +} + |