summaryrefslogtreecommitdiff
path: root/modules/emacs/emacs.nix
diff options
context:
space:
mode:
authorLeonardo Santiago <[email protected]>2024-03-14 16:02:18 -0300
committerLeonardo Santiago <[email protected]>2024-03-14 16:02:18 -0300
commit1ff39bc2cff34cb4aef22785d0d70bbc90efa3f5 (patch)
tree911d6570ccb3918f2839ef87dd633c91ed346874 /modules/emacs/emacs.nix
first commit
Diffstat (limited to 'modules/emacs/emacs.nix')
-rw-r--r--modules/emacs/emacs.nix48
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/emacs/emacs.nix b/modules/emacs/emacs.nix
new file mode 100644
index 0000000..14aadf2
--- /dev/null
+++ b/modules/emacs/emacs.nix
@@ -0,0 +1,48 @@
+{ pkgs, inputs, ...}:
+let
+ outside-emacs = [
+ (pkgs.python3.withPackages (p: (with p; [
+ python-lsp-server
+ python-lsp-ruff
+ pylsp-mypy
+ ])))
+ pkgs.nil
+ pkgs.rust-analyzer
+ pkgs.parallel
+ ];
+ org-tangle-elisp-blocks = (pkgs.callPackage ./org.nix {inherit pkgs; from-elisp = 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; };
+ 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;
+ override = final: prev: {
+ final.buildInputs = prev.buildInputs or [] ++ outside-emacs;
+ };
+ });
+in
+{
+ config = {
+ nixpkgs.overlays = [ inputs.emacs-overlay.overlays.default ];
+ environment.systemPackages = [
+ emacs
+ ] ++ outside-emacs;
+ fonts.packages = with pkgs; [
+ emacs-all-the-icons-fonts
+ (nerdfonts.override { fonts = ["Iosevka"]; })
+ ];
+ };
+}
+