This repository has been archived on 2024-07-03. You can view files and clone it, but cannot push or open issues or pull requests.
home-manager/programs/emacs/default.nix

190 lines
4.1 KiB
Nix
Raw Normal View History

{
config,
pkgs,
fonts,
...
}: {
imports = [
../shell/default.nix
./python/default.nix
./lua/default.nix
];
services.emacs = {
enable = true;
package = config.programs.emacs.finalPackage;
defaultEditor = true;
client.enable = true;
2024-06-13 07:12:47 +01:00
socketActivation.enable = true;
startWithUserSession = false;
};
programs.emacs = {
# Clone emacs config from https://git.xenia.me.uk/pixelifytica/emacs.git
# git clone https://git.xenia.me.uk/pixelifytica/emacs.git ~/.emacs.d
enable = true;
package = pkgs.emacs29-pgtk;
extraConfig = let
fixed-font-family = "${fonts.monospace.name}";
variable-font-family = "${fonts.sansSerif.name}";
font-height = builtins.toString (builtins.floor (builtins.mul fonts.sizes.applications 10));
custom-theme-name = "nix";
custom-theme = pkgs.writeTextFile {
name = "custom-emacs-theme";
destination = "/${custom-theme-name}-theme.el";
text = ''
(deftheme ${custom-theme-name}
"Use Nix customised fonts for main faces")
(custom-theme-set-faces
'${custom-theme-name}
'(default ((t (:family "${fixed-font-family}" :height ${font-height}))))
'(fixed-pitch ((t (:family "${fixed-font-family}"))))
'(fixed-pitch-serif ((t (:family "${fixed-font-family}"))))
'(variable-pitch ((t (:family "${variable-font-family}")))))
(provide-theme '${custom-theme-name})
'';
};
custom-theme-hash = builtins.hashFile "sha256" "${custom-theme}/${custom-theme-name}-theme.el";
in ''
(add-to-list 'custom-theme-load-path "${custom-theme}")
(add-to-list 'custom-safe-themes "${custom-theme-hash}")
(load-theme '${custom-theme-name})
'';
extraPackages = epkgs:
with epkgs; [
# Theme
base16-theme
# UI
all-the-icons
nerd-icons
nerd-icons-completion
nerd-icons-corfu
nerd-icons-dired
nerd-icons-ibuffer
diminish
ligature
page-break-lines
helpful
which-key
2024-05-22 10:11:33 +01:00
ace-window
link-hint
diff-hl
# Completion
cape
consult
consult-eglot
consult-flyspell
corfu
corfu-terminal
embark
embark-consult
marginalia
orderless
vertico
# Templates
tempel
license-templates
gitignore-templates
# spell-checking
flyspell-correct
# password-store
pass
password-store
# IDE
treesit-grammars.with-all-grammars
treesit-auto
flymake-popon
flymake-shellcheck
flymake-yamllint
apheleia
envrc
rainbow-delimiters
aggressive-indent
python-docstring
2024-05-16 10:39:45 +01:00
nix-mode
lua-mode
# Media
emms
# org-mode
org-roam
org-noter
org-journal
# org-cite
citar
citar-embark
# org-mode HTML export
htmlize
# Projects
ibuffer-project
magit
forge
2024-06-04 17:26:37 +01:00
treemacs
treemacs-nerd-icons
# Writing
markdown-mode
pandoc-mode
auctex
auctex-latexmk
latex-preview-pane
2024-06-12 07:31:52 +01:00
# Contacts
bbdb
mu4e
2024-06-12 07:31:52 +01:00
ement
# RSS feeds
elfeed
elfeed-org
elfeed-tube
];
};
home.packages = with pkgs; [
# Emacs requirements
imagemagick
languagetool
wordnet
graphviz # For org-roam graph
mp3info # For EMMS
# Language-specific requirements
sqlite
pandoc
ghostscript
poppler_utils
# Customised LaTeX install
(texlive.combine
{inherit (pkgs.texlive) scheme-medium dvisvgm dvipng wrapfig amsmath ulem hyperref capt-of;})
python3Packages.pygments
# Development tools
## Linters
shellcheck
yamllint
## Formatters
alejandra
shfmt
2024-05-15 11:59:24 +01:00
ruff
isort
stylua
nodePackages.prettier
## Language servers
pyright
lua-language-server
];
}