dotfiles/modules/home/emacs/default.nix

96 lines
2.7 KiB
Nix

{
# Snowfall Lib provides a customized `lib` instance with access to your flake's library
# as well as the libraries available from your flake's inputs.
lib,
# An instance of `pkgs` with your overlays and packages applied is also available.
pkgs,
# You also have access to your flake's inputs.
inputs,
# Additional metadata is provided by Snowfall Lib.
system, # The system architecture for this host (eg. `x86_64-linux`).
target, # The Snowfall Lib target for this system (eg. `x86_64-iso`).
format, # A normalized name for the system target (eg. `iso`).
virtual, # A boolean to determine whether this system is a virtual target using nixos-generators.
systems, # An attribute map of your defined hosts.
# All other arguments come from the module system.
config,
...
}:
with lib;
let
cfg = config.modules.emacs;
doomRepoUrl = "https://github.com/doomemacs/doomemacs";
configRepoUrl = "https://gitlab.julian-mutter.de/julian/emacs-config";
in
{
options.modules.emacs = {
enable = mkOption { default = false; };
};
config = mkIf cfg.enable {
home.sessionPath = [ "/home/julian/.config/emacs/bin" ];
home.packages =
with pkgs;
[
binutils # native-comp needs 'as', provided by this
## Doom dependencies
git
(ripgrep.override { withPCRE2 = true; })
## Optional dependencies
fd # faster projectile indexing
imagemagick # for image-dired
zstd # for undo-fu-session/undo-tree compression
## Module dependencies
(aspellWithDicts (
ds: with ds; [
en
en-computers
en-science
de
]
))
hunspell
hunspellDicts.de_DE
hunspellDicts.en_US
sqlite
# Code formatters for use with doom emacs
nixfmt-rfc-style # nix
nixd # nix lsp
dockfmt # docker
google-java-format # java
black # python
rustfmt # rust
shfmt
pyright
clang-tools # c++ lsp etc
graphviz
# Lsps for use with doom emacs
# neocmakelsp # cmake
emacs-all-the-icons-fonts
]
++ lib.optional config.modules.non-nixos.is-nixos emacs;
home.activation.installDoomEmacs = lib.home-manager.hm.dag.entryAfter [ "writeBoundary" ] ''
if [ ! -d "/home/julian/.config/emacs" ]; then
$DRY_RUN_CMD ${pkgs.git}/bin/git clone --depth=1 --single-branch "${doomRepoUrl}" "/home/julian/.config/emacs"
fi
if [ ! -d "/home/julian/.config/doom" ]; then
$DRY_RUN_CMD ${pkgs.git}/bin/git clone "${configRepoUrl}" "/home/julian/.config/doom"
fi
'';
};
}