From 62100c9265a4de389d1ea8060cbddddacde161a7 Mon Sep 17 00:00:00 2001 From: Leonardo Santiago Date: Thu, 12 Sep 2024 21:44:46 -0300 Subject: split users/leonardo.nix into modules with options in order to be able to deploy just a few of those to iori.nix --- modules/emacs/README.org | 4 ++-- modules/emacs/default.nix | 57 +++++++++++++++++++++++++++++++++++++++++++++ modules/emacs/emacs.nix | 59 ----------------------------------------------- 3 files changed, 59 insertions(+), 61 deletions(-) create mode 100644 modules/emacs/default.nix delete mode 100644 modules/emacs/emacs.nix (limited to 'modules/emacs') diff --git a/modules/emacs/README.org b/modules/emacs/README.org index 0b8ff54..81c0775 100644 --- a/modules/emacs/README.org +++ b/modules/emacs/README.org @@ -388,12 +388,12 @@ Actual mu4e definition (use-package mu4e :bind ("C-c m" . mu4e) :custom - (mu4e-notification-support t) (read-mail-command 'mu4e) (mu4e-index-cleanup nil) (mu4e-index-lazy-check t) (mu4e-use-fancy-chars (display-graphic-p)) (mu4e-confirm-quit nil) + (mu4e-eldoc-support t) (mu4e-change-filenames-when-moving t) (mu4e-update-interval (* 5 60)) (mu4e-get-mail-command "parallel mbsync ::: personal work university") @@ -417,7 +417,7 @@ Actual mu4e definition (cond ((personal-p msg) "/personal/[Gmail]/Todos\ os\ e-mails") ((university-p msg) "/university/[Gmail]/Todos\ os\ e-mails") - ((work-p msg) "/work/[Gmail]/'All mail'")))) + ((work-p msg) "/work/[Gmail]/All\ mail")))) (mu4e-trash-folder (lambda (msg) (cond ((personal-p msg) "/personal/[Gmail]/Lixeira") 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"]; }) + ]; + }; +} + diff --git a/modules/emacs/emacs.nix b/modules/emacs/emacs.nix deleted file mode 100644 index bc73977..0000000 --- a/modules/emacs/emacs.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ pkgs, inputs, ...}: -let - outside-emacs = with pkgs; [ - (python3.withPackages (p: (with p; [ - python-lsp-server - python-lsp-ruff - pylsp-mypy - ]))) - nil - parallel - 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 -{ - config = { - 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"]; }) - ]; - }; -} - -- cgit v1.2.3