nixos/system/home/emacs/default.nix
Evie Litherland-Smith 522f2fa91c Move fonts into stylix config, disable stylix waybar
Remove fonts and scheme from base system, update uses of to point to
stylix instead.

Remove some left over files from the earlier rearrange.

Disable waybar stylix target - TODO write a custom moustache at some
point to re-enable with my custom style
2024-09-20 08:33:10 +01:00

135 lines
3.3 KiB
Nix

{ config, pkgs, ... }:
{
imports = [ ../shell/default.nix ];
stylix.targets.emacs.enable = false;
services.emacs = {
enable = true;
package = config.programs.emacs.finalPackage;
defaultEditor = true;
client.enable = true;
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 = "${config.stylix.fonts.monospace.name}";
variable-font-family = "${config.stylix.fonts.sansSerif.name}";
font-height = builtins.toString (
builtins.floor (builtins.mul config.stylix.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-variables
'${custom-theme-name}
'(menu-bar-mode nil))
(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; [
treesit-grammars.with-all-grammars
mu4e
emacsql-sqlite
];
};
home.packages = with pkgs; [
# Emacs requirements
imagemagick
languagetool
wordnet
# Plugin requirements
gcc
sqlite
pandoc
ghostscript
poppler_utils
graphviz
mp3info
# Customised LaTeX install
(texlive.combine {
inherit (texlive)
scheme-medium
dvisvgm
dvipng
wrapfig
amsmath
ulem
hyperref
capt-of
listings
;
})
# Development tools
## Code screenshots
silicon
## Python Environments
uv
poetry
## Linters
shellcheck
yamllint
ruff
nodePackages.eslint
## Formatters
nixfmt-rfc-style
shfmt
stylua
nodePackages.prettier
## Language servers
nixd
lua-language-server
nodePackages.typescript-language-server
## Interpreters
(python3.withPackages (
ps: with ps; [
tkinter
python-lsp-server
mypy
numpy
scipy
xarray
matplotlib
]
))
(luajit.withPackages (ps: [ (ps.callPackage ./luarocks/scilua.nix { }) ]))
];
xdg.configFile = {
"ruff/pyproject.toml".source = ./ruff.toml;
"pypoetry/config.toml".source = ./pypoetry.toml;
};
}